1.3.1 • Published 3 years ago
aps-data-api v1.3.1
aps-data-api
npm package for APS company for data extraction
- This package contains two methods of data extraction
getServiceAccounts- It gives the response in the form of list ofservice-accountsrelated to givenuser-accountgetMonthlyUtilityData- It gives the response in the form of list ofmonthly-utility-datafor givenservice-account
Installation
npm i aps-data-api --save
How to use?
import { APSUtilityDataService } from 'aps-data-api';
const apsUtilityDataService = new APSUtilityDataService();
const payload: GetDataPayload = {
password: string;
username: string;
};
const res = await apsUtilityDataService.getServiceAccounts(payload)After data extraction, we will get response as -
res: UtilityUserAccountResponse = {
id: string
name: string
serviceAccounts[]: [{id:string, address:Address}]
};const res = await apsUtilityDataService.getMonthlyUtilityData(payload)After data extraction, we will get response as -
res: MonthlyUtilityData[] = {
id: string
amountInCents: number
energyConsumptionInWatts: number
month: string
serviceAccountId: string
year: number
};Methods
getServiceAccounts: (
payload: GetDataPayload,
) => Promise<UtilityUserAccountResponse>;
getMonthlyUtilityData: (
payload: GetDataPayload,
) => Promise<MonthlyUtilityData[]>;
setProxy:(proxy: string[]) => Promise<void>Options
GetDataPayload = {
password: string;
username: string;
};
WHERE,
password: password of the user-account
username: username of the user-account
proxy:string[]
WHERE,
proxy: VGS proxy we setResponses
UtilityUserAccountResponse = {
id: string
name: string
serviceAccounts[]: [{id:string, address:Address}]
};
WHERE,
id: user-account id
name: Name of the user
serviceAccounts[]: List of service-accounts which are linked to given user-account idMonthlyUtilityData[] = {
id: string
amountInCents: number
energyConsumptionInWatts: number
month: string
serviceAccountId: string
year: number
};
WHERE,
id: id of monthly utility data model
amountInCents: Cost of electricity used in respective month and year in cents
energyConsumptionInWatts: Amount of electricity consumed in respective month and year in watts
month: Month of year for which utility data is extracted
serviceAccountId: service-account id for which utility data is extracted
year: Year of calender for which utility data is extractedScripts
npm run build- For building the app.npm run test- Run automated test cases viamochaandchai.npm run start- For starting the app.npm run serve- For building and starting the app with auto-reload on changes.npm run lint- To perform linting
Overview
Typescript support
Environment specific configuation support. The application use config npm module.
Linting support
npm run lintError Handling
- If we pass incorrect credentials for getting utility-data, then...
import { APSUtilityDataService } from 'aps-data-api';
const apsUtilityDataService = new APSUtilityDataService();
const payload: GetDataPayload = {
password: incorrect-username;
username: incorrect-password;
};
const res = await apsUtilityDataService.getServiceAccounts(payload)The Promise gets rejected with
AuthenticationErrorwith message -access_deniedIf we pass correct credentials for getting utility-data, but data extraction failed and service cannot extract data, then...
import { APSUtilityDataService } from 'aps-data-api';
const apsUtilityDataService = new APSUtilityDataService();
const payload: GetDataPayload = {
password: correct-username;
username: correct-password;
};
const res = await apsUtilityDataService.getMonthlyUtilityData(payload)- The Promise gets rejected with
DataExtractionErrorwith message -Failed to extract data
1.3.1
3 years ago
1.3.0
3 years ago
1.2.9
3 years ago
1.2.8
3 years ago
1.2.7
3 years ago
1.2.6
3 years ago
1.2.5
3 years ago
1.2.4
3 years ago
1.2.0
3 years ago
1.2.3
3 years ago
1.2.2
3 years ago
1.2.1
3 years ago
1.0.2
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago