From 71e04635649947bd552e0cc90907be276b44e9ba Mon Sep 17 00:00:00 2001 From: huzaif Date: Wed, 6 Jan 2021 00:00:20 +0530 Subject: [PATCH] updated types --- lib/resources/numbers.js | 24 ++++++++++++++++++ types/resources/accounts.d.ts | 4 +-- types/resources/applications.d.ts | 2 +- types/resources/media.d.ts | 2 +- types/resources/messages.d.ts | 2 +- types/resources/numbers.d.ts | 33 +++++++++++++++++++++---- types/resources/phlo.d.ts | 6 ++--- types/resources/phloMultipartyCall.d.ts | 12 ++++----- types/resources/powerpacks.d.ts | 4 +-- types/rest/client-test.d.ts | 4 +-- 10 files changed, 70 insertions(+), 23 deletions(-) diff --git a/lib/resources/numbers.js b/lib/resources/numbers.js index 14c8152..5b0cc8b 100644 --- a/lib/resources/numbers.js +++ b/lib/resources/numbers.js @@ -22,6 +22,30 @@ export class BuyNumberResponse { } } +export class SearchNumberResponse { + constructor(params) { + params = params || {}; + this.number = params.number; + this.prefix = params.prefix; + this.city = params.city; + this.country = params.country; + this.region = params.region; + this.rate_center = params.rate_center; + this.lata = params.lata; + this.type = params.type; + this.sub_type = params.sub_type; + this.setup_rate = params.setup_rate; + this.monthly_rental_rate = params.monthly_rental_rate; + this.sms_enabled = params.sms_enabled; + this.sms_rate = params.sms_rate; + this.voice_enabled = params.voice_enabled; + this.voice_rate = params.voice_rate; + this.restriction = params.restriction; + this.restriction_text = params.restriction_text; + this.resource_uri = params.resource_uri; + } +} + export class UpdateNumberResponse { constructor(params) { params = params || {}; diff --git a/types/resources/accounts.d.ts b/types/resources/accounts.d.ts index 0ad6a79..fd613e7 100644 --- a/types/resources/accounts.d.ts +++ b/types/resources/accounts.d.ts @@ -103,7 +103,7 @@ export class SubaccountInterface extends PlivoResourceInterface { * @promise {Subaccount} return object of subaccount * @fail {Error} return Error */ - update(id: string, name: string, enabled: boolean): Promise; + update(id: string, name: string, enabled: boolean): Promise; /** * delete subaccount * @method @@ -163,7 +163,7 @@ export class AccountInterface extends PlivoResourceInterface { name: string; city: string; address: string; - }): Promise; + }): Promise; [clientKey]: symbol; } import { PlivoResource } from "../base"; diff --git a/types/resources/applications.d.ts b/types/resources/applications.d.ts index fa5b5f3..ed57fcd 100644 --- a/types/resources/applications.d.ts +++ b/types/resources/applications.d.ts @@ -140,7 +140,7 @@ export class ApplicationInterface extends PlivoResourceInterface { defaultEndpointApp: boolean; subaccount: string; logIncomingMessages: boolean; - }): Promise; + }): Promise; /** * delete Application * @method diff --git a/types/resources/media.d.ts b/types/resources/media.d.ts index b812126..8a025bf 100644 --- a/types/resources/media.d.ts +++ b/types/resources/media.d.ts @@ -42,7 +42,7 @@ export class MediaInterface extends PlivoResourceInterface { * @method * @fail {Error} return Error */ - upload(files: any): Promise; + upload(files: Array): Promise; /** * Get Media by given id * @method diff --git a/types/resources/messages.d.ts b/types/resources/messages.d.ts index 891058f..4a9ea8c 100644 --- a/types/resources/messages.d.ts +++ b/types/resources/messages.d.ts @@ -88,7 +88,7 @@ export class MessageInterface extends PlivoResourceInterface { type: string; url: string; method: string; - media_urls: any; + media_urls: Array; log: boolean; }): Promise < MessageResponse > ; /** diff --git a/types/resources/numbers.d.ts b/types/resources/numbers.d.ts index d2ca408..25c2c42 100644 --- a/types/resources/numbers.d.ts +++ b/types/resources/numbers.d.ts @@ -9,6 +9,29 @@ export class UpdateNumberResponse { apiId: string; message: string; } + +export class SearchNumberResponse { + constructor(params: object); + number: string; + prefix: string; + city: string; + country: string; + region: string; + rate_center: string; + lata: number; + type: string; + sub_type: string; + setup_rate: string; + monthly_rental_rate: string; + sms_enabled: boolean; + sms_rate: string; + voice_enabled: boolean; + voice_rate: string; + restriction: any; + restriction_text: any; + resource_uri: string; +} + /** * Represents a PhoneNumber * @constructor @@ -44,7 +67,7 @@ export class PhoneNumberInterface extends PlivoResourceInterface { * @promise {@link PlivoGenericResponse} return PlivoGenericResponse Object if success * @fail {Error} return Error */ - buy(number: string, appId: string): Promise < BuyNumberResponse > ; + buy(number: string, appId: string): Promise < any > ; [clientKey]: symbol; } /** @@ -81,7 +104,7 @@ export class NumberInterface extends PlivoResourceInterface { * @promise {@link PlivoGenericResponse} return PlivoGenericResponse Object if success * @fail {Error} return Error */ - buy(number: string, appId: string): Promise < any > ; + buy(number: string, appId: string): Promise < BuyNumberResponse > ; /** * Add own number from carrier * @method @@ -92,7 +115,7 @@ export class NumberInterface extends PlivoResourceInterface { * @promise {@link PlivoGenericResponse} return PlivoGenericResponse Object if success * @fail {Error} return Error */ - addOwnNumber(numbers: string, carrier: string, region: string, optionalParams: object): Promise < any > ; + addOwnNumber(numbers: string, carrier: string, region: string, optionalParams: object): Promise < UpdateNumberResponse > ; /** * Add own number from carrier * @method @@ -101,7 +124,7 @@ export class NumberInterface extends PlivoResourceInterface { * @promise {@link PhoneNumberInterface} return PhoneNumbers Object if success * @fail {Error} return Error */ - search(countryISO: string, optionalParams: object): Promise < any > ; + search(countryISO: string, optionalParams: object): Promise < SearchNumberResponse > ; /** * Update Number * @method @@ -117,7 +140,7 @@ export class NumberInterface extends PlivoResourceInterface { appId: string; subAccount: string; alias: string; - }): Promise < any > ; + }): Promise < UpdateNumberResponse > ; /** * Unrent Number * @method diff --git a/types/resources/phlo.d.ts b/types/resources/phlo.d.ts index e891e35..699905b 100644 --- a/types/resources/phlo.d.ts +++ b/types/resources/phlo.d.ts @@ -2,14 +2,14 @@ export class RunPHLOResponse { constructor(params: object); apiid: string; phloid: string; - message: any; + message: string; } export class RetrievePHLOResponse { constructor(params: object); apiid: string; phloid: string; - name: any; - createdOn: any; + name: string; + createdOn: string; } /** * Represents a Phlo diff --git a/types/resources/phloMultipartyCall.d.ts b/types/resources/phloMultipartyCall.d.ts index fb82e63..976907f 100644 --- a/types/resources/phloMultipartyCall.d.ts +++ b/types/resources/phloMultipartyCall.d.ts @@ -16,12 +16,12 @@ export class PhloMultiPartyCall extends PlivoResource { constructor(client: function, data ? : {}); action: string; client: function; - member: (memberAddress: any) => PhloMultiPartyCallMember; - call(triggerSource: any, to: any, role: any): Promise < any > ; - warmTransfer(triggerSource: any, to: any, role: any): Promise < UpdateMultipartyCallResponse > ; - coldTransfer(triggerSource: any, to: any, role: any): Promise < UpdateMultipartyCallResponse > ; - abortTransfer(memberAddress: any): Promise; - update(action: any, triggerSource: any, to: any, role: any): Promise; + member: (memberAddress: string) => PhloMultiPartyCallMember; + call(triggerSource: string, to: string, role: string): Promise < any > ; + warmTransfer(triggerSource: string, to: string, role: string): Promise < UpdateMultipartyCallResponse > ; + coldTransfer(triggerSource: string, to: string, role: string): Promise < UpdateMultipartyCallResponse > ; + abortTransfer(memberAddress: string): Promise; + update(action: string, triggerSource: string, to: string, role: string): Promise; [clientKey]: symbol; } export class PhloMultiPartyCallInterface extends PlivoResourceInterface { diff --git a/types/resources/powerpacks.d.ts b/types/resources/powerpacks.d.ts index 701ad5d..cfa72bf 100644 --- a/types/resources/powerpacks.d.ts +++ b/types/resources/powerpacks.d.ts @@ -24,7 +24,7 @@ export class UpdatePowerpackResponse { applicationType: string; createdOn: string; localConnect: string; - name: string; + name: string; numberPool: string; stickySender: string; uuid: string; @@ -44,7 +44,7 @@ export class ListTollFreeResponse { export class AddNumberResponse { constructor(params: object); apiId: string; - accountPhoneNumberResource: string; + accountPhoneNumberResource: string; addedOn: string; countryIso2: string; number: string; diff --git a/types/rest/client-test.d.ts b/types/rest/client-test.d.ts index 15f2b17..6e73f73 100644 --- a/types/rest/client-test.d.ts +++ b/types/rest/client-test.d.ts @@ -1,5 +1,5 @@ export class Client { - constructor(authid: string, authToken: any, proxy: any); + constructor(authid: string, authToken: string, proxy: string); calls: CallInterface; accounts: AccountInterface; subAccounts: SubaccountInterface; @@ -20,7 +20,7 @@ export class Client { * You can also pass in additional parameters accepted by the node requests module. */ export class PhloClient { - constructor(authid: string, authToken: any, options: any); + constructor(authid: string, authToken: string, options: string); phlo: (phloid: string) => Phlo; } import { CallInterface } from "../resources/call.js";