updated types

This commit is contained in:
huzaif 2021-01-05 22:46:55 +05:30
parent 6884ba55f9
commit b5fd78f526
22 changed files with 96 additions and 98 deletions

View file

@ -1,8 +1,6 @@
import {PlivoResource, PlivoResourceInterface} from '../base';
import {extend, validate} from '../utils/common.js';
import { PlivoGenericResponse } from '../../dist/base';
const clientKey = Symbol();
const action = 'Subaccount/';
const idField = 'authId';

6
types/base.d.ts vendored
View file

@ -1,10 +1,10 @@
export class PlivoGenericResponse {
constructor(params: any, idString: any);
id: any;
id: string;
}
export class PlivoResource {
constructor(action: any, klass: any, idField: any, request: any);
update(params: any, id: any): Promise<any>;
update(params: any, id: string): Promise<any>;
delete(params: any): Promise<any>;
executeAction(task: string, method: string, params: {}, action: any): Promise<any>;
customexecuteAction(url: any, method?: string, params?: {}): Promise<any>;
@ -13,7 +13,7 @@ export class PlivoResource {
}
export class PlivoResourceInterface {
constructor(action: any, klass: any, idField: any, request: any);
get(id: any, params?: {}): Promise<any>;
get(id: string, params?: {}): Promise<any>;
list(params: any): Promise<any>;
create(params: any): Promise<any>;
}

View file

@ -27,7 +27,7 @@ export class CreateSubAccountResponse {
}
export class UpdateSubAccountDetails {
constructor(params: object);
apiId: stringy;
apiId: string;
message: string;
}
export class UpdateAccountDetailsResponse {
@ -48,8 +48,8 @@ export class GetSubAccountDetails {
resourceUri: string;
}
export class Subaccount extends PlivoResource {
constructor(client: any, data?: {});
id: any;
constructor(client: function, data?: {});
id: string;
/**
* update subaccount
* @method
@ -76,7 +76,7 @@ export class Subaccount extends PlivoResource {
* @param {object} [data] - data of call
*/
export class SubaccountInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
/**
* get subaccount by id
* @method
@ -103,7 +103,7 @@ export class SubaccountInterface extends PlivoResourceInterface {
* @promise {Subaccount} return object of subaccount
* @fail {Error} return Error
*/
update(id: any, name: string, enabled: boolean): Promise<any>;
update(id: string, name: string, enabled: boolean): Promise<any>;
/**
* delete subaccount
* @method
@ -112,7 +112,7 @@ export class SubaccountInterface extends PlivoResourceInterface {
* @promise {boolean} return true if subaccount deleted
* @fail {Error} return Error
*/
delete(id: any, cascade: boolean): Promise<any>;
delete(id: string, cascade: boolean): Promise<any>;
[clientKey]: any;
}
/**
@ -122,8 +122,8 @@ export class SubaccountInterface extends PlivoResourceInterface {
* @param {object} [data] - data of call
*/
export class Account extends PlivoResource {
constructor(client: any, data?: {});
id: any;
constructor(client: function, data?: {});
id: string;
/**
* get account detail
* @method
@ -141,7 +141,7 @@ export class Account extends PlivoResource {
* @param {object} [data] - data of call
*/
export class AccountInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
/**
* get account detail
* @method

View file

@ -55,8 +55,8 @@ export class ListAllApplicationResponse {
subAccount: string;
}
export class Application extends PlivoResource {
constructor(client: any, data?: {});
id: any;
constructor(client: function, data?: {});
id: string;
[clientKey]: any;
}
/**
@ -66,7 +66,7 @@ export class Application extends PlivoResource {
* @param {object} [data] - data of call
*/
export class ApplicationInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
/**
* get application by given id
* @method

View file

@ -118,8 +118,8 @@ export class RecordCallResponse {
* @param {object} [data] - data of call
*/
export class Call extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
/**
* hangup call
* @method
@ -145,7 +145,7 @@ export class Call extends PlivoResource {
alegMethod: string;
blegUrl: string;
blegMethod: string;
}, callUUID: any): Promise < CallTransferResponse > ;
}, callUUid: string): Promise < CallTransferResponse > ;
/**
* record call
* @method
@ -245,7 +245,7 @@ export class Call extends PlivoResource {
* @param {object} [data] - data of call
*/
export class CallInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
/**
* Get A Call Detail
* @method
@ -392,23 +392,23 @@ export class CallInterface extends PlivoResourceInterface {
* @promise {object} returns PlivoGenericResponse Object
* @fail {Error} returns Error
*/
cancel(id: any): Promise < any > ;
cancel(id: string): Promise < any > ;
listLiveCalls(params: any): Promise < any > ;
getLiveCall(id: any): Promise < any > ;
getLiveCall(id: string): Promise < any > ;
listQueuedCalls(): Promise < any > ;
getQueuedCall(id: any): Promise < any > ;
getQueuedCall(id: string): Promise < any > ;
[clientKey]: any;
[liveCallInterfaceKey]: LiveCallInterface;
[queuedCallInterfaceKey]: QueuedCallInterface;
}
export class LiveCallResource extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
[clientKey]: any;
}
export class QueuedCallResource extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
[clientKey]: any;
}
import {
@ -426,7 +426,7 @@ declare const liveCallInterfaceKey: unique symbol;
* @param {object} [data] - data of call
*/
declare class LiveCallInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
[clientKey]: any;
}
declare const queuedCallInterfaceKey: unique symbol;
@ -438,8 +438,8 @@ declare const queuedCallInterfaceKey: unique symbol;
*/
declare class QueuedCallInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
get(id: any): Promise < GetQueuedCallResponse > ;
constructor(client: function, data ? : {});
get(id: string): Promise < GetQueuedCallResponse > ;
list(): Promise < ListAllQueuedCalls > ;
[clientKey]: any;
}

View file

@ -5,8 +5,8 @@ export class CallFeedbackResponse {
status: string;
}
export class CallFeedback extends PlivoResource {
constructor(client: any, data?: {});
id: any;
constructor(client: function, data?: {});
id: string;
[clientKey]: any;
}
/**
@ -16,7 +16,7 @@ export class CallFeedback extends PlivoResource {
* @param {object} [data] - data of call
*/
export class CallFeedbackInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
create(callUUID: string, rating: string, issues?: never[], notes?: string): Promise<CallFeedbackResponse>;
[clientKey]: any;
}

View file

@ -49,8 +49,8 @@ export class DeafMemberResponse {
message: string;
}
export class Conference extends PlivoResource {
constructor(client: any, data?: {});
id: any;
constructor(client: function, data?: {});
id: string;
/**
* hangup conference
* @method
@ -208,7 +208,7 @@ export class Conference extends PlivoResource {
* @param {object} [data] - data of call
*/
export class ConferenceInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
/**
* get conference by id

View file

@ -45,8 +45,8 @@ export class CreateEndpointResponse {
* @param {object} [data] - data of call
*/
export class Endpoint extends PlivoResource {
constructor(client: any, data?: {});
id: any;
constructor(client: function, data?: {});
id: string;
/**
* update Endpoint
* @method
@ -75,7 +75,7 @@ export class Endpoint extends PlivoResource {
* @param {object} [data] - data of call
*/
export class EndpointInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
/**
* Get Endpoint by given id
* @method
@ -116,7 +116,7 @@ export class EndpointInterface extends PlivoResourceInterface {
* @promise {boolean} return true if success
* @fail {Error} return Error
*/
delete(id: any): any;
delete(id: string): any;
[clientKey]: any;
}
import { PlivoResource } from "../base";

View file

@ -8,11 +8,11 @@ export class LookupResponse {
resourceUri: string;
}
export class Number extends PlivoResource {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
[clientKey]: any;
}
export class LookupInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
get(number: string, type?: string): Promise<LookupResponse>;
[clientKey]: any;
}

View file

@ -26,8 +26,8 @@ export class ListMediaResponse {
* @param {object} [data] - data of call
*/
export class Media extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
}
/**
* Represents a Media Interface
@ -36,7 +36,7 @@ export class Media extends PlivoResource {
* @param {object} [data] - data of call
*/
export class MediaInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
/**
* Upload Media
* @method

View file

@ -37,7 +37,7 @@ export class MessageListResponse {
}
export class MMSMediaResponse {
constructor(params: object);
apiId: any;
apiid: string;
objects: MMSMedia[];
}
export class MMSMedia {
@ -57,8 +57,8 @@ export class MMSMedia {
* @param {object} [data] - data of call
*/
export class Message extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
listMedia(): Promise < any > ;
}
/**
@ -68,7 +68,7 @@ export class Message extends PlivoResource {
* @param {object} [data] - data of call
*/
export class MessageInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data?: {});
/**
* Send Message
* @method

View file

@ -16,8 +16,8 @@ export class UpdateNumberResponse {
* @param {object} [data] - data of call
*/
export class PhoneNumber extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
/**
* Buy Phone Number
* @method
@ -36,7 +36,7 @@ export class PhoneNumber extends PlivoResource {
* @param {string} [data.test] - test data
*/
export class PhoneNumberInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
/**
* Buy Phone Number
* @method
@ -54,8 +54,8 @@ export class PhoneNumberInterface extends PlivoResourceInterface {
* @param {object} [data] - data of call
*/
export class NumberResource extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
/**
* Unrent Number
* @method
@ -72,7 +72,7 @@ export class NumberResource extends PlivoResource {
* @param {object} [data] - data of call
*/
export class NumberInterface extends PlivoResourceInterface {
constructor(client: any);
constructor(client: function);
/**
* Buy Phone Number
* @method

View file

@ -1,13 +1,13 @@
export class RunPHLOResponse {
constructor(params: any);
apiId: any;
phloId: any;
apiid: string;
phloid: string;
message: any;
}
export class RetrievePHLOResponse {
constructor(params: any);
apiId: any;
phloId: any;
apiid: string;
phloid: string;
name: any;
createdOn: any;
}
@ -18,9 +18,9 @@ export class RetrievePHLOResponse {
* @param {object} [data] - data of phlo
*/
export class Phlo extends PlivoResource {
constructor(client: any, data ? : {});
client: any;
multiPartyCall: (nodeId: any) => PhloMultiPartyCall;
constructor(client: function, data ? : {});
client: function;
multiPartyCall: (nodeid: string) => PhloMultiPartyCall;
/**
* run phlo
* @method
@ -37,7 +37,7 @@ export class Phlo extends PlivoResource {
* @param {object} [data] - data of call
*/
export class PhloInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
get(id: string): Promise<RetrievePHLOResponse>;
[clientKey]: any;
}

View file

@ -10,9 +10,9 @@ export class UpdateMemberResponse {
error: string;
}
export class PhloMultiPartyCallMember extends PlivoResource {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
action: string;
client: any;
client: function;
resumeCall(): Promise < any > ;
voicemailDrop(): Promise < any > ;
hangup(): Promise < any > ;
@ -21,9 +21,9 @@ export class PhloMultiPartyCallMember extends PlivoResource {
update(action: object): Promise<UpdateMemberResponse>;
}
export class PhloMultiPartyCallMemberInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
action: string;
client: any;
client: function;
get(phloId: string, nodeId: string, memberAddress: string): any;
}
import {

View file

@ -13,9 +13,9 @@ export class RetrieveMultipartyCallResponse {
createdOn: string;
}
export class PhloMultiPartyCall extends PlivoResource {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
action: string;
client: any;
client: function;
member: (memberAddress: any) => PhloMultiPartyCallMember;
call(triggerSource: any, to: any, role: any): Promise < any > ;
warmTransfer(triggerSource: any, to: any, role: any): Promise < UpdateMultipartyCallResponse > ;
@ -25,7 +25,7 @@ export class PhloMultiPartyCall extends PlivoResource {
[clientKey]: any;
}
export class PhloMultiPartyCallInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
get(phloId: string, id: string): Promise<RetrieveMultipartyCallResponse>;
[clientKey]: any;
}

View file

@ -59,12 +59,12 @@ export class RemoveNumberResponse {
}
export class RemoveTollFreeNumberResponse {
constructor(params: object);
apiId: any;
apiid: string;
response: string;
}
export class RemoveShortCodeResponse {
constructor(params: any);
apiId: any;
apiid: string;
response: string;
}
export class AddTollFreeNumberresponse {
@ -113,9 +113,9 @@ export class RetrieveShortCodeResponse {
* @param {object} [data] - data of call
*/
export class Powerpack extends PlivoResource {
constructor(client: any, data ? : {});
uuid: any;
number_pool_id: any;
constructor(client: function, data ? : {});
uuid: string;
number_pool_id: string;
number_pool: NumberPool;
list_numbers(params: object): Promise < ListAllNumbersResponse > ;
search_query(params: object): string;
@ -134,13 +134,13 @@ export class Powerpack extends PlivoResource {
[clientKey]: any;
}
export class NumberPool extends PlivoResource {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
numbers: Numbers;
shortcodes: Shortcode;
tollfree: Tollfree;
}
export class Numbers extends PlivoResource {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
buy_add_number(params: object): any;
list(params: object): Promise < any > ;
count(params: object): Promise < any > ;
@ -150,15 +150,15 @@ export class Numbers extends PlivoResource {
remove(number: string, unrent ? : boolean): Promise < any > ;
}
export class Shortcode extends PlivoResource {
constructor(client: any, data ? : {});
number_pool_id: any;
constructor(client: function, data ? : {});
number_pool_id: string;
list(params: object): Promise < any > ;
find(shortcode: object): Promise < any > ;
remove(shortcode: object): Promise < any > ;
}
export class Tollfree extends PlivoResource {
constructor(client: any, data ? : {});
number_pool_id: any;
constructor(client: function, data ? : {});
number_pool_id: string;
add(tollfree: string): Promise < any > ;
remove(tollfree: string, unrent ? : boolean): Promise < any > ;
list(params: object): Promise < any > ;
@ -171,7 +171,7 @@ export class Tollfree extends PlivoResource {
* @param {object} [data] - data of call
*/
export class PowerpackInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
/**
* get Powerpack by given id
* @method

View file

@ -16,7 +16,7 @@ export class PricingResponse {
voice: object;
}
export class Pricing extends PlivoResource {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
/**
* Get pricings by country
* @method
@ -33,7 +33,7 @@ export class Pricing extends PlivoResource {
* @param {object} [data] - data of call
*/
export class PricingInterface extends PlivoResourceInterface {
constructor(client: any, data?: {});
constructor(client: function, data?: {});
[clientKey]: any;
}
import { PlivoResource } from "../base";

View file

@ -35,8 +35,8 @@ export class ListRecordingResponse {
* @param {object} [data] - data of call
*/
export class Recording extends PlivoResource {
constructor(client: any, data ? : {});
id: any;
constructor(client: function, data ? : {});
id: string;
[clientKey]: any;
}
/**
@ -46,7 +46,7 @@ export class Recording extends PlivoResource {
* @param {object} [data] - data of call
*/
export class RecordingInterface extends PlivoResourceInterface {
constructor(client: any, data ? : {});
constructor(client: function, data ? : {});
/**
* Delete recording by id
* @method

View file

@ -1,5 +1,5 @@
export class Client {
constructor(authId: any, authToken: any, proxy: any);
constructor(authid: string, authToken: any, proxy: any);
calls: CallInterface;
accounts: AccountInterface;
subAccounts: SubaccountInterface;
@ -20,8 +20,8 @@ export class Client {
* You can also pass in additional parameters accepted by the node requests module.
*/
export class PhloClient {
constructor(authId: any, authToken: any, options: any);
phlo: (phloId: any) => Phlo;
constructor(authid: string, authToken: any, options: any);
phlo: (phloid: string) => Phlo;
}
import { CallInterface } from "../resources/call.js";
import { AccountInterface } from "../resources/accounts.js";

View file

@ -4,7 +4,7 @@
* You can also pass in additional parameters accepted by the node requests module.
*/
export class Client {
constructor(authId: any, authToken: any, options?: any);
constructor(authid: string, authToken: any, options?: any);
calls: CallInterface;
accounts: AccountInterface;
subaccounts: SubaccountInterface;
@ -28,8 +28,8 @@ export class Client {
* You can also pass in additional parameters accepted by the node requests module.
*/
export class PhloClient {
constructor(authId: any, authToken: any, options: any);
phlo: (phloId: any) => Phlo;
constructor(authid: string, authToken: any, options: any);
phlo: (phloid: string) => Phlo;
}
import { CallInterface } from "../resources/call.js";
import { AccountInterface } from "../resources/accounts.js";

View file

@ -1,4 +1,4 @@
export function AccessToken(authId: any, authToken: any, username: any, validityOptions?: {}, uid?: any): void;
export function AccessToken(authid: string, authToken: any, username: any, validityOptions?: {}, uid?: any): void;
export class AccessToken {
constructor(authId: string, authToken: string, username: string, validityOptions?: {}, uid?: any);
authId: string;

View file

@ -1,3 +1,3 @@
export function computeOldSignature(authId: any, uri: any, params: any): any;
export function verifyOldSignature(authId: any, uri: any, params: any, signature: any): boolean;
export function validateSignature(uri: any, nonce: any, signature: any, auth_token: any): boolean;
export function computeOldSignature(authid: string, uri: any, params: any): any;
export function verifyOldSignature(authid: string, uri: any, params: any, signature: any): boolean;
export function validateSignature(uri: string, nonce: string, signature: string, auth_token: string): boolean;