@vonage/accounts 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { AuthenticationType, Client } from '@vonage/server-client';
2
+ import { AccountCallbacks } from './interfaces/AccountCallbacks';
3
+ import { AccountUpdateResponse } from './interfaces/Response/AccountUpdateResponse';
4
+ import { GetBalanceResponse } from './interfaces/Response/GetBalanceResponse';
5
+ import { TopUpBalanceResponse } from './interfaces/Response/TopUpBalanceResponse';
6
+ export declare class Accounts extends Client {
7
+ protected authType: AuthenticationType;
8
+ getBalance(): Promise<GetBalanceResponse>;
9
+ topUpBalance(trx: string): Promise<TopUpBalanceResponse>;
10
+ updateAccountCallbacks(callbacks: AccountCallbacks): Promise<AccountUpdateResponse>;
11
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Accounts = void 0;
4
+ const server_client_1 = require("@vonage/server-client");
5
+ class Accounts extends server_client_1.Client {
6
+ authType = server_client_1.AuthenticationType.QUERY_KEY_SECRET;
7
+ async getBalance() {
8
+ const response = await this.sendGetRequest(`${this.config.restHost}/account/get-balance`);
9
+ return response.data;
10
+ }
11
+ async topUpBalance(trx) {
12
+ const response = await this.sendFormSubmitRequest(`${this.config.restHost}/account/top-up`, { trx });
13
+ return response.data;
14
+ }
15
+ async updateAccountCallbacks(callbacks) {
16
+ const response = await this.sendFormSubmitRequest(`${this.config.restHost}/account/settings`, callbacks);
17
+ return response.data;
18
+ }
19
+ }
20
+ exports.Accounts = Accounts;
21
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../lib/accounts.ts"],"names":[],"mappings":";;;AAAA,yDAAkE;AAMlE,MAAa,QAAS,SAAQ,sBAAM;IACtB,QAAQ,GAAG,kCAAkB,CAAC,gBAAgB,CAAA;IAEjD,KAAK,CAAC,UAAU;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CACtC,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,sBAAsB,CAChD,CAAA;QACD,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,GAAW;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAC7C,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,iBAAiB,EACxC,EAAE,GAAG,EAAE,CACV,CAAA;QACD,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC;IAEM,KAAK,CAAC,sBAAsB,CAC/B,SAA2B;QAE3B,MAAM,QAAQ,GACV,MAAM,IAAI,CAAC,qBAAqB,CAC5B,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,mBAAmB,EAC1C,SAAS,CACZ,CAAA;QACL,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC;CACJ;AA5BD,4BA4BC"}
@@ -0,0 +1,2 @@
1
+ export { Accounts } from './accounts';
2
+ export { Secrets } from './secrets';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Secrets = exports.Accounts = void 0;
4
+ var accounts_1 = require("./accounts");
5
+ Object.defineProperty(exports, "Accounts", { enumerable: true, get: function () { return accounts_1.Accounts; } });
6
+ var secrets_1 = require("./secrets");
7
+ Object.defineProperty(exports, "Secrets", { enumerable: true, get: function () { return secrets_1.Secrets; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
@@ -0,0 +1,4 @@
1
+ export interface AccountCallbacks {
2
+ moCallBackUrl?: string;
3
+ drCallBackUrl?: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AccountCallbacks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountCallbacks.js","sourceRoot":"","sources":["../../lib/interfaces/AccountCallbacks.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export interface APISecretResponse {
2
+ _links: {
3
+ self: {
4
+ href: string;
5
+ };
6
+ };
7
+ id: string;
8
+ created_at: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=APISecretResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"APISecretResponse.js","sourceRoot":"","sources":["../../../lib/interfaces/Response/APISecretResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export interface AccountUpdateResponse {
2
+ 'mo-callback-url': string;
3
+ 'dr-callback-url': string;
4
+ 'max-outbound-request': number;
5
+ 'max-inbound-request': number;
6
+ 'max-calls-per-second': number;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AccountUpdateResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountUpdateResponse.js","sourceRoot":"","sources":["../../../lib/interfaces/Response/AccountUpdateResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface GetBalanceResponse {
2
+ value: number;
3
+ autoReload: boolean;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=GetBalanceResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetBalanceResponse.js","sourceRoot":"","sources":["../../../lib/interfaces/Response/GetBalanceResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { APISecretResponse } from './APISecretResponse';
2
+ export interface ListAPISecretsResponse {
3
+ _links: {
4
+ self: {
5
+ href: string;
6
+ };
7
+ };
8
+ _embedded: {
9
+ secrets: APISecretResponse[];
10
+ };
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ListAPISecretsResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListAPISecretsResponse.js","sourceRoot":"","sources":["../../../lib/interfaces/Response/ListAPISecretsResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface TopUpBalanceResponse {
2
+ 'error-code': string;
3
+ 'error-code-label': string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TopUpBalanceResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopUpBalanceResponse.js","sourceRoot":"","sources":["../../../lib/interfaces/Response/TopUpBalanceResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { AuthenticationType, Client } from '@vonage/server-client';
2
+ import { APISecretResponse } from './interfaces/Response/APISecretResponse';
3
+ import { ListAPISecretsResponse } from './interfaces/Response/ListAPISecretsResponse';
4
+ export declare class Secrets extends Client {
5
+ protected authType: AuthenticationType;
6
+ createSecret(apiKey: string, secret: string): Promise<APISecretResponse>;
7
+ deleteSecret(apiKey: string, id: string): Promise<void>;
8
+ getSecret(apiKey: string, id: string): Promise<APISecretResponse>;
9
+ listSecrets(apiKey: string): Promise<ListAPISecretsResponse>;
10
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Secrets = void 0;
4
+ const server_client_1 = require("@vonage/server-client");
5
+ class Secrets extends server_client_1.Client {
6
+ authType = server_client_1.AuthenticationType.BASIC;
7
+ async createSecret(apiKey, secret) {
8
+ const response = await this.sendPostRequest(`${this.config.apiHost}/accounts/${apiKey}/secrets`, { secret });
9
+ return response.data;
10
+ }
11
+ async deleteSecret(apiKey, id) {
12
+ await this.sendDeleteRequest(`${this.config.apiHost}/accounts/${apiKey}/secrets/${id}`);
13
+ }
14
+ async getSecret(apiKey, id) {
15
+ const response = await this.sendGetRequest(`${this.config.apiHost}/accounts/${apiKey}/secrets/${id}`);
16
+ return response.data;
17
+ }
18
+ async listSecrets(apiKey) {
19
+ const response = await this.sendGetRequest(`${this.config.apiHost}/accounts/${apiKey}/secrets`);
20
+ return response.data;
21
+ }
22
+ }
23
+ exports.Secrets = Secrets;
24
+ //# sourceMappingURL=secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.js","sourceRoot":"","sources":["../lib/secrets.ts"],"names":[],"mappings":";;;AAAA,yDAAkE;AAIlE,MAAa,OAAQ,SAAQ,sBAAM;IACrB,QAAQ,GAAG,kCAAkB,CAAC,KAAK,CAAA;IAEtC,KAAK,CAAC,YAAY,CACrB,MAAc,EACd,MAAc;QAEd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CACvC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,aAAa,MAAM,UAAU,EACnD,EAAE,MAAM,EAAE,CACb,CAAA;QACD,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,EAAU;QAChD,MAAM,IAAI,CAAC,iBAAiB,CACxB,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,aAAa,MAAM,YAAY,EAAE,EAAE,CAC5D,CAAA;IACL,CAAC;IAEM,KAAK,CAAC,SAAS,CAClB,MAAc,EACd,EAAU;QAEV,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CACtC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,aAAa,MAAM,YAAY,EAAE,EAAE,CAC5D,CAAA;QACD,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,MAAc;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CACtC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,aAAa,MAAM,UAAU,CACtD,CAAA;QACD,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC;CACJ;AApCD,0BAoCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonage/accounts",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Vonage Account Management API",
5
5
  "homepage": "https://developer.vonage.com",
6
6
  "bugs": {
@@ -27,10 +27,10 @@
27
27
  "compile": "npx tsc --build --verbose"
28
28
  },
29
29
  "dependencies": {
30
- "@vonage/server-client": "^1.1.0"
30
+ "@vonage/server-client": "^1.1.2"
31
31
  },
32
32
  "devDependencies": {
33
- "@vonage/auth": "^1.1.0",
33
+ "@vonage/auth": "^1.1.2",
34
34
  "nock": "^13.2.9"
35
35
  },
36
36
  "publishConfig": {