Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve page payload types #842

Merged
merged 2 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion lib/rest/accounts/v1/authTokenPromotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class AuthTokenPromotionInstance {
protected _solution: AuthTokenPromotionContextSolution;
protected _context?: AuthTokenPromotionContext;

constructor(protected _version: V1, payload: AuthTokenPromotionPayload) {
constructor(protected _version: V1, payload: AuthTokenPromotionResource) {
this.accountSid = payload.account_sid;
this.authToken = payload.auth_token;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
Expand Down
8 changes: 5 additions & 3 deletions lib/rest/accounts/v1/credential/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ export class AwsContextImpl implements AwsContext {
}
}

interface AwsPayload extends AwsResource, TwilioResponsePayload {}
interface AwsPayload extends TwilioResponsePayload {
credentials: AwsResource[];
}

interface AwsResource {
sid?: string | null;
Expand All @@ -257,7 +259,7 @@ export class AwsInstance {
protected _solution: AwsContextSolution;
protected _context?: AwsContext;

constructor(protected _version: V1, payload: AwsPayload, sid?: string) {
constructor(protected _version: V1, payload: AwsResource, sid?: string) {
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
Expand Down Expand Up @@ -671,7 +673,7 @@ export class AwsPage extends Page<V1, AwsPayload, AwsResource, AwsInstance> {
*
* @param payload - Payload response from the API
*/
getInstance(payload: AwsPayload): AwsInstance {
getInstance(payload: AwsResource): AwsInstance {
return new AwsInstance(this._version, payload);
}

Expand Down
12 changes: 9 additions & 3 deletions lib/rest/accounts/v1/credential/publicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ export class PublicKeyContextImpl implements PublicKeyContext {
}
}

interface PublicKeyPayload extends PublicKeyResource, TwilioResponsePayload {}
interface PublicKeyPayload extends TwilioResponsePayload {
credentials: PublicKeyResource[];
}

interface PublicKeyResource {
sid?: string | null;
Expand All @@ -257,7 +259,11 @@ export class PublicKeyInstance {
protected _solution: PublicKeyContextSolution;
protected _context?: PublicKeyContext;

constructor(protected _version: V1, payload: PublicKeyPayload, sid?: string) {
constructor(
protected _version: V1,
payload: PublicKeyResource,
sid?: string
) {
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
Expand Down Expand Up @@ -681,7 +687,7 @@ export class PublicKeyPage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: PublicKeyPayload): PublicKeyInstance {
getInstance(payload: PublicKeyResource): PublicKeyInstance {
return new PublicKeyInstance(this._version, payload);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/rest/accounts/v1/secondaryAuthToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class SecondaryAuthTokenInstance {
protected _solution: SecondaryAuthTokenContextSolution;
protected _context?: SecondaryAuthTokenContext;

constructor(protected _version: V1, payload: SecondaryAuthTokenPayload) {
constructor(protected _version: V1, payload: SecondaryAuthTokenResource) {
this.accountSid = payload.account_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
Expand Down
8 changes: 5 additions & 3 deletions lib/rest/api/v2010/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ export class AccountContextImpl implements AccountContext {
}
}

interface AccountPayload extends AccountResource, TwilioResponsePayload {}
interface AccountPayload extends TwilioResponsePayload {
accounts: AccountResource[];
}

interface AccountResource {
auth_token?: string | null;
Expand All @@ -487,7 +489,7 @@ export class AccountInstance {

constructor(
protected _version: V2010,
payload: AccountPayload,
payload: AccountResource,
sid?: string
) {
this.authToken = payload.auth_token;
Expand Down Expand Up @@ -1095,7 +1097,7 @@ export class AccountPage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: AccountPayload): AccountInstance {
getInstance(payload: AccountResource): AccountInstance {
return new AccountInstance(this._version, payload);
}

Expand Down
8 changes: 5 additions & 3 deletions lib/rest/api/v2010/account/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ export class AddressContextImpl implements AddressContext {
}
}

interface AddressPayload extends AddressResource, TwilioResponsePayload {}
interface AddressPayload extends TwilioResponsePayload {
addresses: AddressResource[];
}

interface AddressResource {
account_sid?: string | null;
Expand All @@ -361,7 +363,7 @@ export class AddressInstance {

constructor(
protected _version: V2010,
payload: AddressPayload,
payload: AddressResource,
accountSid: string,
sid?: string
) {
Expand Down Expand Up @@ -916,7 +918,7 @@ export class AddressPage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: AddressPayload): AddressInstance {
getInstance(payload: AddressResource): AddressInstance {
return new AddressInstance(
this._version,
payload,
Expand Down
10 changes: 5 additions & 5 deletions lib/rest/api/v2010/account/address/dependentPhoneNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ export type DependentPhoneNumberStatusCallbackMethod =
| "PUT"
| "DELETE";

interface DependentPhoneNumberPayload
extends DependentPhoneNumberResource,
TwilioResponsePayload {}
interface DependentPhoneNumberPayload extends TwilioResponsePayload {
dependent_phone_numbers: DependentPhoneNumberResource[];
}

interface DependentPhoneNumberResource {
sid?: string | null;
Expand Down Expand Up @@ -400,7 +400,7 @@ interface DependentPhoneNumberResource {
export class DependentPhoneNumberInstance {
constructor(
protected _version: V2010,
payload: DependentPhoneNumberPayload,
payload: DependentPhoneNumberResource,
accountSid: string,
addressSid: string
) {
Expand Down Expand Up @@ -599,7 +599,7 @@ export class DependentPhoneNumberPage extends Page<
* @param payload - Payload response from the API
*/
getInstance(
payload: DependentPhoneNumberPayload
payload: DependentPhoneNumberResource
): DependentPhoneNumberInstance {
return new DependentPhoneNumberInstance(
this._version,
Expand Down
10 changes: 5 additions & 5 deletions lib/rest/api/v2010/account/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ export type ApplicationVoiceMethod =
| "PUT"
| "DELETE";

interface ApplicationPayload
extends ApplicationResource,
TwilioResponsePayload {}
interface ApplicationPayload extends TwilioResponsePayload {
applications: ApplicationResource[];
}

interface ApplicationResource {
account_sid?: string | null;
Expand Down Expand Up @@ -411,7 +411,7 @@ export class ApplicationInstance {

constructor(
protected _version: V2010,
payload: ApplicationPayload,
payload: ApplicationResource,
accountSid: string,
sid?: string
) {
Expand Down Expand Up @@ -977,7 +977,7 @@ export class ApplicationPage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: ApplicationPayload): ApplicationInstance {
getInstance(payload: ApplicationResource): ApplicationInstance {
return new ApplicationInstance(
this._version,
payload,
Expand Down
10 changes: 5 additions & 5 deletions lib/rest/api/v2010/account/authorizedConnectApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ export class AuthorizedConnectAppContextImpl
}
}

interface AuthorizedConnectAppPayload
extends AuthorizedConnectAppResource,
TwilioResponsePayload {}
interface AuthorizedConnectAppPayload extends TwilioResponsePayload {
authorized_connect_apps: AuthorizedConnectAppResource[];
}

interface AuthorizedConnectAppResource {
account_sid?: string | null;
Expand All @@ -180,7 +180,7 @@ export class AuthorizedConnectAppInstance {

constructor(
protected _version: V2010,
payload: AuthorizedConnectAppPayload,
payload: AuthorizedConnectAppResource,
accountSid: string,
connectAppSid?: string
) {
Expand Down Expand Up @@ -575,7 +575,7 @@ export class AuthorizedConnectAppPage extends Page<
* @param payload - Payload response from the API
*/
getInstance(
payload: AuthorizedConnectAppPayload
payload: AuthorizedConnectAppResource
): AuthorizedConnectAppInstance {
return new AuthorizedConnectAppInstance(
this._version,
Expand Down
10 changes: 5 additions & 5 deletions lib/rest/api/v2010/account/availablePhoneNumberCountry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ export class AvailablePhoneNumberCountryContextImpl
}
}

interface AvailablePhoneNumberCountryPayload
extends AvailablePhoneNumberCountryResource,
TwilioResponsePayload {}
interface AvailablePhoneNumberCountryPayload extends TwilioResponsePayload {
countries: AvailablePhoneNumberCountryResource[];
}

interface AvailablePhoneNumberCountryResource {
country_code?: string | null;
Expand All @@ -276,7 +276,7 @@ export class AvailablePhoneNumberCountryInstance {

constructor(
protected _version: V2010,
payload: AvailablePhoneNumberCountryPayload,
payload: AvailablePhoneNumberCountryResource,
accountSid: string,
countryCode?: string
) {
Expand Down Expand Up @@ -719,7 +719,7 @@ export class AvailablePhoneNumberCountryPage extends Page<
* @param payload - Payload response from the API
*/
getInstance(
payload: AvailablePhoneNumberCountryPayload
payload: AvailablePhoneNumberCountryResource
): AvailablePhoneNumberCountryInstance {
return new AvailablePhoneNumberCountryInstance(
this._version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ export function LocalListInstance(
return instance;
}

interface LocalPayload extends LocalResource, TwilioResponsePayload {}
interface LocalPayload extends TwilioResponsePayload {
available_phone_numbers: LocalResource[];
}

interface LocalResource {
friendly_name?: string | null;
Expand All @@ -468,7 +470,7 @@ interface LocalResource {
export class LocalInstance {
constructor(
protected _version: V2010,
payload: LocalPayload,
payload: LocalResource,
accountSid: string,
countryCode: string
) {
Expand Down Expand Up @@ -591,7 +593,7 @@ export class LocalPage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: LocalPayload): LocalInstance {
getInstance(payload: LocalResource): LocalInstance {
return new LocalInstance(
this._version,
payload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ export function MachineToMachineListInstance(
return instance;
}

interface MachineToMachinePayload
extends MachineToMachineResource,
TwilioResponsePayload {}
interface MachineToMachinePayload extends TwilioResponsePayload {
available_phone_numbers: MachineToMachineResource[];
}

interface MachineToMachineResource {
friendly_name?: string | null;
Expand All @@ -482,7 +482,7 @@ interface MachineToMachineResource {
export class MachineToMachineInstance {
constructor(
protected _version: V2010,
payload: MachineToMachinePayload,
payload: MachineToMachineResource,
accountSid: string,
countryCode: string
) {
Expand Down Expand Up @@ -605,7 +605,7 @@ export class MachineToMachinePage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: MachineToMachinePayload): MachineToMachineInstance {
getInstance(payload: MachineToMachineResource): MachineToMachineInstance {
return new MachineToMachineInstance(
this._version,
payload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ export function MobileListInstance(
return instance;
}

interface MobilePayload extends MobileResource, TwilioResponsePayload {}
interface MobilePayload extends TwilioResponsePayload {
available_phone_numbers: MobileResource[];
}

interface MobileResource {
friendly_name?: string | null;
Expand All @@ -468,7 +470,7 @@ interface MobileResource {
export class MobileInstance {
constructor(
protected _version: V2010,
payload: MobilePayload,
payload: MobileResource,
accountSid: string,
countryCode: string
) {
Expand Down Expand Up @@ -591,7 +593,7 @@ export class MobilePage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: MobilePayload): MobileInstance {
getInstance(payload: MobileResource): MobileInstance {
return new MobileInstance(
this._version,
payload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ export function NationalListInstance(
return instance;
}

interface NationalPayload extends NationalResource, TwilioResponsePayload {}
interface NationalPayload extends TwilioResponsePayload {
available_phone_numbers: NationalResource[];
}

interface NationalResource {
friendly_name?: string | null;
Expand All @@ -468,7 +470,7 @@ interface NationalResource {
export class NationalInstance {
constructor(
protected _version: V2010,
payload: NationalPayload,
payload: NationalResource,
accountSid: string,
countryCode: string
) {
Expand Down Expand Up @@ -591,7 +593,7 @@ export class NationalPage extends Page<
*
* @param payload - Payload response from the API
*/
getInstance(payload: NationalPayload): NationalInstance {
getInstance(payload: NationalResource): NationalInstance {
return new NationalInstance(
this._version,
payload,
Expand Down
Loading