Auto-commit 2026-04-29 16:31

This commit is contained in:
2026-04-29 16:31:27 -04:00
parent e8687bb6b2
commit 0495ee5bd2
19691 changed files with 3272886 additions and 138 deletions

75
node_modules/twilio/lib/rest/messaging/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,75 @@
import MessagingBase from "../MessagingBase";
import Version from "../../base/Version";
import { BrandRegistrationListInstance } from "./v1/brandRegistration";
import { DeactivationsListInstance } from "./v1/deactivations";
import { DomainCertsListInstance } from "./v1/domainCerts";
import { DomainConfigListInstance } from "./v1/domainConfig";
import { DomainConfigMessagingServiceListInstance } from "./v1/domainConfigMessagingService";
import { DomainValidateDnListInstance } from "./v1/domainValidateDn";
import { ExternalCampaignListInstance } from "./v1/externalCampaign";
import { LinkshorteningMessagingServiceListInstance } from "./v1/linkshorteningMessagingService";
import { LinkshorteningMessagingServiceDomainAssociationListInstance } from "./v1/linkshorteningMessagingServiceDomainAssociation";
import { RequestManagedCertListInstance } from "./v1/requestManagedCert";
import { ServiceListInstance } from "./v1/service";
import { TollfreeVerificationListInstance } from "./v1/tollfreeVerification";
import { UsecaseListInstance } from "./v1/usecase";
export default class V1 extends Version {
/**
* Initialize the V1 version of Messaging
*
* @param domain - The Twilio (Twilio.Messaging) domain
*/
constructor(domain: MessagingBase);
/** brandRegistrations - { Twilio.Messaging.V1.BrandRegistrationListInstance } resource */
protected _brandRegistrations?: BrandRegistrationListInstance;
/** deactivations - { Twilio.Messaging.V1.DeactivationsListInstance } resource */
protected _deactivations?: DeactivationsListInstance;
/** domainCerts - { Twilio.Messaging.V1.DomainCertsListInstance } resource */
protected _domainCerts?: DomainCertsListInstance;
/** domainConfig - { Twilio.Messaging.V1.DomainConfigListInstance } resource */
protected _domainConfig?: DomainConfigListInstance;
/** domainConfigMessagingService - { Twilio.Messaging.V1.DomainConfigMessagingServiceListInstance } resource */
protected _domainConfigMessagingService?: DomainConfigMessagingServiceListInstance;
/** domainValidateDns - { Twilio.Messaging.V1.DomainValidateDnListInstance } resource */
protected _domainValidateDns?: DomainValidateDnListInstance;
/** externalCampaign - { Twilio.Messaging.V1.ExternalCampaignListInstance } resource */
protected _externalCampaign?: ExternalCampaignListInstance;
/** linkshorteningMessagingService - { Twilio.Messaging.V1.LinkshorteningMessagingServiceListInstance } resource */
protected _linkshorteningMessagingService?: LinkshorteningMessagingServiceListInstance;
/** linkshorteningMessagingServiceDomainAssociation - { Twilio.Messaging.V1.LinkshorteningMessagingServiceDomainAssociationListInstance } resource */
protected _linkshorteningMessagingServiceDomainAssociation?: LinkshorteningMessagingServiceDomainAssociationListInstance;
/** requestManagedCert - { Twilio.Messaging.V1.RequestManagedCertListInstance } resource */
protected _requestManagedCert?: RequestManagedCertListInstance;
/** services - { Twilio.Messaging.V1.ServiceListInstance } resource */
protected _services?: ServiceListInstance;
/** tollfreeVerifications - { Twilio.Messaging.V1.TollfreeVerificationListInstance } resource */
protected _tollfreeVerifications?: TollfreeVerificationListInstance;
/** usecases - { Twilio.Messaging.V1.UsecaseListInstance } resource */
protected _usecases?: UsecaseListInstance;
/** Getter for brandRegistrations resource */
get brandRegistrations(): BrandRegistrationListInstance;
/** Getter for deactivations resource */
get deactivations(): DeactivationsListInstance;
/** Getter for domainCerts resource */
get domainCerts(): DomainCertsListInstance;
/** Getter for domainConfig resource */
get domainConfig(): DomainConfigListInstance;
/** Getter for domainConfigMessagingService resource */
get domainConfigMessagingService(): DomainConfigMessagingServiceListInstance;
/** Getter for domainValidateDns resource */
get domainValidateDns(): DomainValidateDnListInstance;
/** Getter for externalCampaign resource */
get externalCampaign(): ExternalCampaignListInstance;
/** Getter for linkshorteningMessagingService resource */
get linkshorteningMessagingService(): LinkshorteningMessagingServiceListInstance;
/** Getter for linkshorteningMessagingServiceDomainAssociation resource */
get linkshorteningMessagingServiceDomainAssociation(): LinkshorteningMessagingServiceDomainAssociationListInstance;
/** Getter for requestManagedCert resource */
get requestManagedCert(): RequestManagedCertListInstance;
/** Getter for services resource */
get services(): ServiceListInstance;
/** Getter for tollfreeVerifications resource */
get tollfreeVerifications(): TollfreeVerificationListInstance;
/** Getter for usecases resource */
get usecases(): UsecaseListInstance;
}

120
node_modules/twilio/lib/rest/messaging/V1.js generated vendored Normal file
View File

@@ -0,0 +1,120 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const brandRegistration_1 = require("./v1/brandRegistration");
const deactivations_1 = require("./v1/deactivations");
const domainCerts_1 = require("./v1/domainCerts");
const domainConfig_1 = require("./v1/domainConfig");
const domainConfigMessagingService_1 = require("./v1/domainConfigMessagingService");
const domainValidateDn_1 = require("./v1/domainValidateDn");
const externalCampaign_1 = require("./v1/externalCampaign");
const linkshorteningMessagingService_1 = require("./v1/linkshorteningMessagingService");
const linkshorteningMessagingServiceDomainAssociation_1 = require("./v1/linkshorteningMessagingServiceDomainAssociation");
const requestManagedCert_1 = require("./v1/requestManagedCert");
const service_1 = require("./v1/service");
const tollfreeVerification_1 = require("./v1/tollfreeVerification");
const usecase_1 = require("./v1/usecase");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Messaging
*
* @param domain - The Twilio (Twilio.Messaging) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for brandRegistrations resource */
get brandRegistrations() {
this._brandRegistrations =
this._brandRegistrations || (0, brandRegistration_1.BrandRegistrationListInstance)(this);
return this._brandRegistrations;
}
/** Getter for deactivations resource */
get deactivations() {
this._deactivations =
this._deactivations || (0, deactivations_1.DeactivationsListInstance)(this);
return this._deactivations;
}
/** Getter for domainCerts resource */
get domainCerts() {
this._domainCerts = this._domainCerts || (0, domainCerts_1.DomainCertsListInstance)(this);
return this._domainCerts;
}
/** Getter for domainConfig resource */
get domainConfig() {
this._domainConfig = this._domainConfig || (0, domainConfig_1.DomainConfigListInstance)(this);
return this._domainConfig;
}
/** Getter for domainConfigMessagingService resource */
get domainConfigMessagingService() {
this._domainConfigMessagingService =
this._domainConfigMessagingService ||
(0, domainConfigMessagingService_1.DomainConfigMessagingServiceListInstance)(this);
return this._domainConfigMessagingService;
}
/** Getter for domainValidateDns resource */
get domainValidateDns() {
this._domainValidateDns =
this._domainValidateDns || (0, domainValidateDn_1.DomainValidateDnListInstance)(this);
return this._domainValidateDns;
}
/** Getter for externalCampaign resource */
get externalCampaign() {
this._externalCampaign =
this._externalCampaign || (0, externalCampaign_1.ExternalCampaignListInstance)(this);
return this._externalCampaign;
}
/** Getter for linkshorteningMessagingService resource */
get linkshorteningMessagingService() {
this._linkshorteningMessagingService =
this._linkshorteningMessagingService ||
(0, linkshorteningMessagingService_1.LinkshorteningMessagingServiceListInstance)(this);
return this._linkshorteningMessagingService;
}
/** Getter for linkshorteningMessagingServiceDomainAssociation resource */
get linkshorteningMessagingServiceDomainAssociation() {
this._linkshorteningMessagingServiceDomainAssociation =
this._linkshorteningMessagingServiceDomainAssociation ||
(0, linkshorteningMessagingServiceDomainAssociation_1.LinkshorteningMessagingServiceDomainAssociationListInstance)(this);
return this._linkshorteningMessagingServiceDomainAssociation;
}
/** Getter for requestManagedCert resource */
get requestManagedCert() {
this._requestManagedCert =
this._requestManagedCert || (0, requestManagedCert_1.RequestManagedCertListInstance)(this);
return this._requestManagedCert;
}
/** Getter for services resource */
get services() {
this._services = this._services || (0, service_1.ServiceListInstance)(this);
return this._services;
}
/** Getter for tollfreeVerifications resource */
get tollfreeVerifications() {
this._tollfreeVerifications =
this._tollfreeVerifications || (0, tollfreeVerification_1.TollfreeVerificationListInstance)(this);
return this._tollfreeVerifications;
}
/** Getter for usecases resource */
get usecases() {
this._usecases = this._usecases || (0, usecase_1.UsecaseListInstance)(this);
return this._usecases;
}
}
exports.default = V1;

25
node_modules/twilio/lib/rest/messaging/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import MessagingBase from "../MessagingBase";
import Version from "../../base/Version";
import { ChannelsSenderListInstance } from "./v2/channelsSender";
import { DomainCertsListInstance } from "./v2/domainCerts";
import { TypingIndicatorListInstance } from "./v2/typingIndicator";
export default class V2 extends Version {
/**
* Initialize the V2 version of Messaging
*
* @param domain - The Twilio (Twilio.Messaging) domain
*/
constructor(domain: MessagingBase);
/** channelsSenders - { Twilio.Messaging.V2.ChannelsSenderListInstance } resource */
protected _channelsSenders?: ChannelsSenderListInstance;
/** domainCerts - { Twilio.Messaging.V2.DomainCertsListInstance } resource */
protected _domainCerts?: DomainCertsListInstance;
/** typingIndicator - { Twilio.Messaging.V2.TypingIndicatorListInstance } resource */
protected _typingIndicator?: TypingIndicatorListInstance;
/** Getter for channelsSenders resource */
get channelsSenders(): ChannelsSenderListInstance;
/** Getter for domainCerts resource */
get domainCerts(): DomainCertsListInstance;
/** Getter for typingIndicator resource */
get typingIndicator(): TypingIndicatorListInstance;
}

50
node_modules/twilio/lib/rest/messaging/V2.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const channelsSender_1 = require("./v2/channelsSender");
const domainCerts_1 = require("./v2/domainCerts");
const typingIndicator_1 = require("./v2/typingIndicator");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Messaging
*
* @param domain - The Twilio (Twilio.Messaging) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Getter for channelsSenders resource */
get channelsSenders() {
this._channelsSenders =
this._channelsSenders || (0, channelsSender_1.ChannelsSenderListInstance)(this);
return this._channelsSenders;
}
/** Getter for domainCerts resource */
get domainCerts() {
this._domainCerts = this._domainCerts || (0, domainCerts_1.DomainCertsListInstance)(this);
return this._domainCerts;
}
/** Getter for typingIndicator resource */
get typingIndicator() {
this._typingIndicator =
this._typingIndicator || (0, typingIndicator_1.TypingIndicatorListInstance)(this);
return this._typingIndicator;
}
}
exports.default = V2;

View File

@@ -0,0 +1,462 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { BrandRegistrationOtpListInstance } from "./brandRegistration/brandRegistrationOtp";
import { BrandVettingListInstance } from "./brandRegistration/brandVetting";
/**
* DEPRECATED. Feedback on how to improve brand score
*/
export type BrandRegistrationBrandFeedback = "TAX_ID" | "STOCK_SYMBOL" | "NONPROFIT" | "GOVERNMENT_ENTITY" | "OTHERS";
/**
* When a brand is registered, TCR will attempt to verify the identity of the brand based on the supplied information.
*/
export type BrandRegistrationIdentityStatus = "SELF_DECLARED" | "UNVERIFIED" | "VERIFIED" | "VETTED_VERIFIED";
/**
* Brand Registration status. One of \"PENDING\", \"APPROVED\", \"FAILED\", \"IN_REVIEW\", \"DELETION_PENDING\", \"DELETION_FAILED\", \"SUSPENDED\".
*/
export type BrandRegistrationStatus = "PENDING" | "APPROVED" | "FAILED" | "IN_REVIEW" | "DELETION_PENDING" | "DELETION_FAILED" | "SUSPENDED";
/**
* Options to pass to create a BrandRegistrationInstance
*/
export interface BrandRegistrationListInstanceCreateOptions {
/** Customer Profile Bundle Sid. */
customerProfileBundleSid: string;
/** A2P Messaging Profile Bundle Sid. */
a2PProfileBundleSid: string;
/** Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases. */
brandType?: string;
/** A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. */
mock?: boolean;
/** A flag to disable automatic secondary vetting for brands which it would otherwise be done. */
skipAutomaticSecVet?: boolean;
}
/**
* Options to pass to each
*/
export interface BrandRegistrationListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface BrandRegistrationListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface BrandRegistrationListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface BrandRegistrationContext {
brandRegistrationOtps: BrandRegistrationOtpListInstance;
brandVettings: BrandVettingListInstance;
/**
* Fetch a BrandRegistrationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
fetch(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
/**
* Fetch a BrandRegistrationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
/**
* Update a BrandRegistrationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
update(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
/**
* Update a BrandRegistrationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface BrandRegistrationContextSolution {
sid: string;
}
export declare class BrandRegistrationContextImpl implements BrandRegistrationContext {
protected _version: V1;
protected _solution: BrandRegistrationContextSolution;
protected _uri: string;
protected _brandRegistrationOtps?: BrandRegistrationOtpListInstance;
protected _brandVettings?: BrandVettingListInstance;
constructor(_version: V1, sid: string);
get brandRegistrationOtps(): BrandRegistrationOtpListInstance;
get brandVettings(): BrandVettingListInstance;
fetch(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
update(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): BrandRegistrationContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface BrandRegistrationPayload extends TwilioResponsePayload {
data: BrandRegistrationResource[];
}
interface BrandRegistrationResource {
sid: string;
account_sid: string;
customer_profile_bundle_sid: string;
a2p_profile_bundle_sid: string;
date_created: Date;
date_updated: Date;
brand_type: string;
status: BrandRegistrationStatus;
tcr_id: string;
failure_reason: string;
errors: Array<any>;
url: string;
brand_score: number;
brand_feedback: Array<BrandRegistrationBrandFeedback>;
identity_status: BrandRegistrationIdentityStatus;
russell_3000: boolean;
government_entity: boolean;
tax_exempt_status: string;
skip_automatic_sec_vet: boolean;
mock: boolean;
links: Record<string, string>;
}
export declare class BrandRegistrationInstance {
protected _version: V1;
protected _solution: BrandRegistrationContextSolution;
protected _context?: BrandRegistrationContext;
constructor(_version: V1, payload: BrandRegistrationResource, sid?: string);
/**
* The unique string to identify Brand Registration.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource.
*/
accountSid: string;
/**
* A2P Messaging Profile Bundle BundleSid.
*/
customerProfileBundleSid: string;
/**
* A2P Messaging Profile Bundle BundleSid.
*/
a2pProfileBundleSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand.
*/
brandType: string;
status: BrandRegistrationStatus;
/**
* Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration.
*/
tcrId: string;
/**
* DEPRECATED. A reason why brand registration has failed. Only applicable when status is FAILED.
*/
failureReason: string;
/**
* A list of errors that occurred during the brand registration process.
*/
errors: Array<any>;
/**
* The absolute URL of the Brand Registration resource.
*/
url: string;
/**
* The secondary vetting score if it was done. Otherwise, it will be the brand score if it\'s returned from TCR. It may be null if no score is available.
*/
brandScore: number;
/**
* DEPRECATED. Feedback on how to improve brand score
*/
brandFeedback: Array<BrandRegistrationBrandFeedback>;
identityStatus: BrandRegistrationIdentityStatus;
/**
* Publicly traded company identified in the Russell 3000 Index
*/
russell3000: boolean;
/**
* Identified as a government entity
*/
governmentEntity: boolean;
/**
* Nonprofit organization tax-exempt status per section 501 of the U.S. tax code.
*/
taxExemptStatus: string;
/**
* A flag to disable automatic secondary vetting for brands which it would otherwise be done.
*/
skipAutomaticSecVet: boolean;
/**
* A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided.
*/
mock: boolean;
links: Record<string, string>;
private get _proxy();
/**
* Fetch a BrandRegistrationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
fetch(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
/**
* Fetch a BrandRegistrationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
/**
* Update a BrandRegistrationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
update(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
/**
* Update a BrandRegistrationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
/**
* Access the brandRegistrationOtps.
*/
brandRegistrationOtps(): BrandRegistrationOtpListInstance;
/**
* Access the brandVettings.
*/
brandVettings(): BrandVettingListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
customerProfileBundleSid: string;
a2pProfileBundleSid: string;
dateCreated: Date;
dateUpdated: Date;
brandType: string;
status: BrandRegistrationStatus;
tcrId: string;
failureReason: string;
errors: any[];
url: string;
brandScore: number;
brandFeedback: BrandRegistrationBrandFeedback[];
identityStatus: BrandRegistrationIdentityStatus;
russell3000: boolean;
governmentEntity: boolean;
taxExemptStatus: string;
skipAutomaticSecVet: boolean;
mock: boolean;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface BrandRegistrationSolution {
}
export interface BrandRegistrationListInstance {
_version: V1;
_solution: BrandRegistrationSolution;
_uri: string;
(sid: string): BrandRegistrationContext;
get(sid: string): BrandRegistrationContext;
/**
* Create a BrandRegistrationInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
create(params: BrandRegistrationListInstanceCreateOptions, callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>;
/**
* Create a BrandRegistrationInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
createWithHttpInfo(params: BrandRegistrationListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationInstance>) => any): Promise<ApiResponse<BrandRegistrationInstance>>;
/**
* Streams BrandRegistrationInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandRegistrationListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void): void;
each(params: BrandRegistrationListInstanceEachOptions, callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void): void;
/**
* Streams BrandRegistrationInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandRegistrationListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: BrandRegistrationListInstanceEachOptions, callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of BrandRegistrationInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: BrandRegistrationPage) => any): Promise<BrandRegistrationPage>;
/**
* Retrieve a single target page of BrandRegistrationInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<BrandRegistrationPage>) => any): Promise<ApiResponse<BrandRegistrationPage>>;
/**
* Lists BrandRegistrationInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandRegistrationListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: BrandRegistrationInstance[]) => any): Promise<BrandRegistrationInstance[]>;
list(params: BrandRegistrationListInstanceOptions, callback?: (error: Error | null, items: BrandRegistrationInstance[]) => any): Promise<BrandRegistrationInstance[]>;
/**
* Lists BrandRegistrationInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandRegistrationListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BrandRegistrationInstance[]>) => any): Promise<ApiResponse<BrandRegistrationInstance[]>>;
listWithHttpInfo(params: BrandRegistrationListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<BrandRegistrationInstance[]>) => any): Promise<ApiResponse<BrandRegistrationInstance[]>>;
/**
* Retrieve a single page of BrandRegistrationInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandRegistrationListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: BrandRegistrationPage) => any): Promise<BrandRegistrationPage>;
page(params: BrandRegistrationListInstancePageOptions, callback?: (error: Error | null, items: BrandRegistrationPage) => any): Promise<BrandRegistrationPage>;
/**
* Retrieve a single page of BrandRegistrationInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandRegistrationListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BrandRegistrationPage>) => any): Promise<ApiResponse<BrandRegistrationPage>>;
pageWithHttpInfo(params: BrandRegistrationListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<BrandRegistrationPage>) => any): Promise<ApiResponse<BrandRegistrationPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BrandRegistrationListInstance(version: V1): BrandRegistrationListInstance;
export declare class BrandRegistrationPage extends Page<V1, BrandRegistrationPayload, BrandRegistrationResource, BrandRegistrationInstance> {
/**
* Initialize the BrandRegistrationPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: BrandRegistrationSolution);
/**
* Build an instance of BrandRegistrationInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: BrandRegistrationResource): BrandRegistrationInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,444 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrandRegistrationPage = exports.BrandRegistrationInstance = exports.BrandRegistrationContextImpl = void 0;
exports.BrandRegistrationListInstance = BrandRegistrationListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const brandRegistrationOtp_1 = require("./brandRegistration/brandRegistrationOtp");
const brandVetting_1 = require("./brandRegistration/brandVetting");
class BrandRegistrationContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/a2p/BrandRegistrations/${sid}`;
}
get brandRegistrationOtps() {
this._brandRegistrationOtps =
this._brandRegistrationOtps ||
(0, brandRegistrationOtp_1.BrandRegistrationOtpListInstance)(this._version, this._solution.sid);
return this._brandRegistrationOtps;
}
get brandVettings() {
this._brandVettings =
this._brandVettings ||
(0, brandVetting_1.BrandVettingListInstance)(this._version, this._solution.sid);
return this._brandVettings;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new BrandRegistrationInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new BrandRegistrationInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new BrandRegistrationInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new BrandRegistrationInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandRegistrationContextImpl = BrandRegistrationContextImpl;
class BrandRegistrationInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.customerProfileBundleSid = payload.customer_profile_bundle_sid;
this.a2pProfileBundleSid = payload.a2p_profile_bundle_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.brandType = payload.brand_type;
this.status = payload.status;
this.tcrId = payload.tcr_id;
this.failureReason = payload.failure_reason;
this.errors = payload.errors;
this.url = payload.url;
this.brandScore = deserialize.integer(payload.brand_score);
this.brandFeedback = payload.brand_feedback;
this.identityStatus = payload.identity_status;
this.russell3000 = payload.russell_3000;
this.governmentEntity = payload.government_entity;
this.taxExemptStatus = payload.tax_exempt_status;
this.skipAutomaticSecVet = payload.skip_automatic_sec_vet;
this.mock = payload.mock;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new BrandRegistrationContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a BrandRegistrationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a BrandRegistrationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Update a BrandRegistrationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance
*/
update(callback) {
return this._proxy.update(callback);
}
/**
* Update a BrandRegistrationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationInstance with HTTP metadata
*/
updateWithHttpInfo(callback) {
return this._proxy.updateWithHttpInfo(callback);
}
/**
* Access the brandRegistrationOtps.
*/
brandRegistrationOtps() {
return this._proxy.brandRegistrationOtps;
}
/**
* Access the brandVettings.
*/
brandVettings() {
return this._proxy.brandVettings;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
customerProfileBundleSid: this.customerProfileBundleSid,
a2pProfileBundleSid: this.a2pProfileBundleSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
brandType: this.brandType,
status: this.status,
tcrId: this.tcrId,
failureReason: this.failureReason,
errors: this.errors,
url: this.url,
brandScore: this.brandScore,
brandFeedback: this.brandFeedback,
identityStatus: this.identityStatus,
russell3000: this.russell3000,
governmentEntity: this.governmentEntity,
taxExemptStatus: this.taxExemptStatus,
skipAutomaticSecVet: this.skipAutomaticSecVet,
mock: this.mock,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandRegistrationInstance = BrandRegistrationInstance;
function BrandRegistrationListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new BrandRegistrationContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/a2p/BrandRegistrations`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["customerProfileBundleSid"] === null ||
params["customerProfileBundleSid"] === undefined) {
throw new Error("Required parameter \"params['customerProfileBundleSid']\" missing.");
}
if (params["a2PProfileBundleSid"] === null ||
params["a2PProfileBundleSid"] === undefined) {
throw new Error("Required parameter \"params['a2PProfileBundleSid']\" missing.");
}
let data = {};
data["CustomerProfileBundleSid"] = params["customerProfileBundleSid"];
data["A2PProfileBundleSid"] = params["a2PProfileBundleSid"];
if (params["brandType"] !== undefined)
data["BrandType"] = params["brandType"];
if (params["mock"] !== undefined)
data["Mock"] = serialize.bool(params["mock"]);
if (params["skipAutomaticSecVet"] !== undefined)
data["SkipAutomaticSecVet"] = serialize.bool(params["skipAutomaticSecVet"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new BrandRegistrationInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["customerProfileBundleSid"] === null ||
params["customerProfileBundleSid"] === undefined) {
throw new Error("Required parameter \"params['customerProfileBundleSid']\" missing.");
}
if (params["a2PProfileBundleSid"] === null ||
params["a2PProfileBundleSid"] === undefined) {
throw new Error("Required parameter \"params['a2PProfileBundleSid']\" missing.");
}
let data = {};
data["CustomerProfileBundleSid"] = params["customerProfileBundleSid"];
data["A2PProfileBundleSid"] = params["a2PProfileBundleSid"];
if (params["brandType"] !== undefined)
data["BrandType"] = params["brandType"];
if (params["mock"] !== undefined)
data["Mock"] = serialize.bool(params["mock"]);
if (params["skipAutomaticSecVet"] !== undefined)
data["SkipAutomaticSecVet"] = serialize.bool(params["skipAutomaticSecVet"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new BrandRegistrationInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new BrandRegistrationPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new BrandRegistrationPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new BrandRegistrationPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new BrandRegistrationPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class BrandRegistrationPage extends Page_1.default {
/**
* Initialize the BrandRegistrationPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of BrandRegistrationInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new BrandRegistrationInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandRegistrationPage = BrandRegistrationPage;

View File

@@ -0,0 +1,60 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export interface BrandRegistrationOtpSolution {
brandRegistrationSid: string;
}
export interface BrandRegistrationOtpListInstance {
_version: V1;
_solution: BrandRegistrationOtpSolution;
_uri: string;
/**
* Create a BrandRegistrationOtpInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationOtpInstance
*/
create(callback?: (error: Error | null, item?: BrandRegistrationOtpInstance) => any): Promise<BrandRegistrationOtpInstance>;
/**
* Create a BrandRegistrationOtpInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandRegistrationOtpInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandRegistrationOtpInstance>) => any): Promise<ApiResponse<BrandRegistrationOtpInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BrandRegistrationOtpListInstance(version: V1, brandRegistrationSid: string): BrandRegistrationOtpListInstance;
interface BrandRegistrationOtpResource {
account_sid: string;
brand_registration_sid: string;
}
export declare class BrandRegistrationOtpInstance {
protected _version: V1;
constructor(_version: V1, payload: BrandRegistrationOtpResource, brandRegistrationSid: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource.
*/
accountSid: string;
/**
* The unique string to identify Brand Registration of Sole Proprietor Brand
*/
brandRegistrationSid: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
brandRegistrationSid: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,89 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrandRegistrationOtpInstance = void 0;
exports.BrandRegistrationOtpListInstance = BrandRegistrationOtpListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
function BrandRegistrationOtpListInstance(version, brandRegistrationSid) {
if (!(0, utility_1.isValidPathParam)(brandRegistrationSid)) {
throw new Error("Parameter 'brandRegistrationSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { brandRegistrationSid };
instance._uri = `/a2p/BrandRegistrations/${brandRegistrationSid}/SmsOtp`;
instance.create = function create(callback) {
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new BrandRegistrationOtpInstance(operationVersion, payload, instance._solution.brandRegistrationSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new BrandRegistrationOtpInstance(operationVersion, response.body, instance._solution.brandRegistrationSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class BrandRegistrationOtpInstance {
constructor(_version, payload, brandRegistrationSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.brandRegistrationSid = payload.brand_registration_sid;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
brandRegistrationSid: this.brandRegistrationSid,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandRegistrationOtpInstance = BrandRegistrationOtpInstance;

View File

@@ -0,0 +1,340 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* The third-party provider that has conducted the vetting. One of “CampaignVerify” (Campaign Verify tokens) or “AEGIS” (Secondary Vetting).
*/
export type BrandVettingVettingProvider = "campaign-verify" | "aegis";
/**
* Options to pass to create a BrandVettingInstance
*/
export interface BrandVettingListInstanceCreateOptions {
/** */
vettingProvider: BrandVettingVettingProvider;
/** The unique ID of the vetting */
vettingId?: string;
}
/**
* Options to pass to each
*/
export interface BrandVettingListInstanceEachOptions {
/** The third-party provider of the vettings to read */
vettingProvider?: BrandVettingVettingProvider;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface BrandVettingListInstanceOptions {
/** The third-party provider of the vettings to read */
vettingProvider?: BrandVettingVettingProvider;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface BrandVettingListInstancePageOptions {
/** The third-party provider of the vettings to read */
vettingProvider?: BrandVettingVettingProvider;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface BrandVettingContext {
/**
* Fetch a BrandVettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance
*/
fetch(callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>;
/**
* Fetch a BrandVettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandVettingInstance>) => any): Promise<ApiResponse<BrandVettingInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface BrandVettingContextSolution {
brandSid: string;
brandVettingSid: string;
}
export declare class BrandVettingContextImpl implements BrandVettingContext {
protected _version: V1;
protected _solution: BrandVettingContextSolution;
protected _uri: string;
constructor(_version: V1, brandSid: string, brandVettingSid: string);
fetch(callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandVettingInstance>) => any): Promise<ApiResponse<BrandVettingInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): BrandVettingContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface BrandVettingPayload extends TwilioResponsePayload {
data: BrandVettingResource[];
}
interface BrandVettingResource {
account_sid: string;
brand_sid: string;
brand_vetting_sid: string;
date_updated: Date;
date_created: Date;
vetting_id: string;
vetting_class: string;
vetting_status: string;
vetting_provider: BrandVettingVettingProvider;
url: string;
}
export declare class BrandVettingInstance {
protected _version: V1;
protected _solution: BrandVettingContextSolution;
protected _context?: BrandVettingContext;
constructor(_version: V1, payload: BrandVettingResource, brandSid: string, brandVettingSid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record.
*/
accountSid: string;
/**
* The unique string to identify Brand Registration.
*/
brandSid: string;
/**
* The Twilio SID of the third-party vetting record.
*/
brandVettingSid: string;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The unique identifier of the vetting from the third-party provider.
*/
vettingId: string;
/**
* The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify).
*/
vettingClass: string;
/**
* The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”.
*/
vettingStatus: string;
vettingProvider: BrandVettingVettingProvider;
/**
* The absolute URL of the Brand Vetting resource.
*/
url: string;
private get _proxy();
/**
* Fetch a BrandVettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance
*/
fetch(callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>;
/**
* Fetch a BrandVettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BrandVettingInstance>) => any): Promise<ApiResponse<BrandVettingInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
brandSid: string;
brandVettingSid: string;
dateUpdated: Date;
dateCreated: Date;
vettingId: string;
vettingClass: string;
vettingStatus: string;
vettingProvider: BrandVettingVettingProvider;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface BrandVettingSolution {
brandSid: string;
}
export interface BrandVettingListInstance {
_version: V1;
_solution: BrandVettingSolution;
_uri: string;
(brandVettingSid: string): BrandVettingContext;
get(brandVettingSid: string): BrandVettingContext;
/**
* Create a BrandVettingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance
*/
create(params: BrandVettingListInstanceCreateOptions, callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>;
/**
* Create a BrandVettingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance with HTTP metadata
*/
createWithHttpInfo(params: BrandVettingListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<BrandVettingInstance>) => any): Promise<ApiResponse<BrandVettingInstance>>;
/**
* Streams BrandVettingInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandVettingListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void): void;
each(params: BrandVettingListInstanceEachOptions, callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void): void;
/**
* Streams BrandVettingInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandVettingListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: BrandVettingListInstanceEachOptions, callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of BrandVettingInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: BrandVettingPage) => any): Promise<BrandVettingPage>;
/**
* Retrieve a single target page of BrandVettingInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<BrandVettingPage>) => any): Promise<ApiResponse<BrandVettingPage>>;
/**
* Lists BrandVettingInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandVettingListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: BrandVettingInstance[]) => any): Promise<BrandVettingInstance[]>;
list(params: BrandVettingListInstanceOptions, callback?: (error: Error | null, items: BrandVettingInstance[]) => any): Promise<BrandVettingInstance[]>;
/**
* Lists BrandVettingInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandVettingListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BrandVettingInstance[]>) => any): Promise<ApiResponse<BrandVettingInstance[]>>;
listWithHttpInfo(params: BrandVettingListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<BrandVettingInstance[]>) => any): Promise<ApiResponse<BrandVettingInstance[]>>;
/**
* Retrieve a single page of BrandVettingInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandVettingListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: BrandVettingPage) => any): Promise<BrandVettingPage>;
page(params: BrandVettingListInstancePageOptions, callback?: (error: Error | null, items: BrandVettingPage) => any): Promise<BrandVettingPage>;
/**
* Retrieve a single page of BrandVettingInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { BrandVettingListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BrandVettingPage>) => any): Promise<ApiResponse<BrandVettingPage>>;
pageWithHttpInfo(params: BrandVettingListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<BrandVettingPage>) => any): Promise<ApiResponse<BrandVettingPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BrandVettingListInstance(version: V1, brandSid: string): BrandVettingListInstance;
export declare class BrandVettingPage extends Page<V1, BrandVettingPayload, BrandVettingResource, BrandVettingInstance> {
/**
* Initialize the BrandVettingPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: BrandVettingSolution);
/**
* Build an instance of BrandVettingInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: BrandVettingResource): BrandVettingInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,335 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrandVettingPage = exports.BrandVettingInstance = exports.BrandVettingContextImpl = void 0;
exports.BrandVettingListInstance = BrandVettingListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class BrandVettingContextImpl {
constructor(_version, brandSid, brandVettingSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(brandSid)) {
throw new Error("Parameter 'brandSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(brandVettingSid)) {
throw new Error("Parameter 'brandVettingSid' is not valid.");
}
this._solution = { brandSid, brandVettingSid };
this._uri = `/a2p/BrandRegistrations/${brandSid}/Vettings/${brandVettingSid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new BrandVettingInstance(operationVersion, payload, instance._solution.brandSid, instance._solution.brandVettingSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new BrandVettingInstance(operationVersion, response.body, instance._solution.brandSid, instance._solution.brandVettingSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandVettingContextImpl = BrandVettingContextImpl;
class BrandVettingInstance {
constructor(_version, payload, brandSid, brandVettingSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.brandSid = payload.brand_sid;
this.brandVettingSid = payload.brand_vetting_sid;
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.vettingId = payload.vetting_id;
this.vettingClass = payload.vetting_class;
this.vettingStatus = payload.vetting_status;
this.vettingProvider = payload.vetting_provider;
this.url = payload.url;
this._solution = {
brandSid,
brandVettingSid: brandVettingSid || this.brandVettingSid,
};
}
get _proxy() {
this._context =
this._context ||
new BrandVettingContextImpl(this._version, this._solution.brandSid, this._solution.brandVettingSid);
return this._context;
}
/**
* Fetch a BrandVettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a BrandVettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BrandVettingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
brandSid: this.brandSid,
brandVettingSid: this.brandVettingSid,
dateUpdated: this.dateUpdated,
dateCreated: this.dateCreated,
vettingId: this.vettingId,
vettingClass: this.vettingClass,
vettingStatus: this.vettingStatus,
vettingProvider: this.vettingProvider,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandVettingInstance = BrandVettingInstance;
function BrandVettingListInstance(version, brandSid) {
if (!(0, utility_1.isValidPathParam)(brandSid)) {
throw new Error("Parameter 'brandSid' is not valid.");
}
const instance = ((brandVettingSid) => instance.get(brandVettingSid));
instance.get = function get(brandVettingSid) {
return new BrandVettingContextImpl(version, brandSid, brandVettingSid);
};
instance._version = version;
instance._solution = { brandSid };
instance._uri = `/a2p/BrandRegistrations/${brandSid}/Vettings`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["vettingProvider"] === null ||
params["vettingProvider"] === undefined) {
throw new Error("Required parameter \"params['vettingProvider']\" missing.");
}
let data = {};
data["VettingProvider"] = params["vettingProvider"];
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new BrandVettingInstance(operationVersion, payload, instance._solution.brandSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["vettingProvider"] === null ||
params["vettingProvider"] === undefined) {
throw new Error("Required parameter \"params['vettingProvider']\" missing.");
}
let data = {};
data["VettingProvider"] = params["vettingProvider"];
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new BrandVettingInstance(operationVersion, response.body, instance._solution.brandSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new BrandVettingPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new BrandVettingPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new BrandVettingPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new BrandVettingPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class BrandVettingPage extends Page_1.default {
/**
* Initialize the BrandVettingPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of BrandVettingInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new BrandVettingInstance(this._version, payload, this._solution.brandSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BrandVettingPage = BrandVettingPage;

View File

@@ -0,0 +1,141 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to fetch a DeactivationsInstance
*/
export interface DeactivationsContextFetchOptions {
/** The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format. */
date?: Date;
}
export interface DeactivationsContext {
/**
* Fetch a DeactivationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance
*/
fetch(callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>;
/**
* Fetch a DeactivationsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance
*/
fetch(params: DeactivationsContextFetchOptions, callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>;
/**
* Fetch a DeactivationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DeactivationsInstance>) => any): Promise<ApiResponse<DeactivationsInstance>>;
/**
* Fetch a DeactivationsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance with HTTP metadata
*/
fetchWithHttpInfo(params: DeactivationsContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<DeactivationsInstance>) => any): Promise<ApiResponse<DeactivationsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DeactivationsContextSolution {
}
export declare class DeactivationsContextImpl implements DeactivationsContext {
protected _version: V1;
protected _solution: DeactivationsContextSolution;
protected _uri: string;
constructor(_version: V1);
fetch(params?: DeactivationsContextFetchOptions | ((error: Error | null, item?: DeactivationsInstance) => any), callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>;
fetchWithHttpInfo(params?: DeactivationsContextFetchOptions | ((error: Error | null, item?: ApiResponse<DeactivationsInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<DeactivationsInstance>) => any): Promise<ApiResponse<DeactivationsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DeactivationsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DeactivationsResource {
redirect_to: string;
}
export declare class DeactivationsInstance {
protected _version: V1;
protected _solution: DeactivationsContextSolution;
protected _context?: DeactivationsContext;
constructor(_version: V1, payload: DeactivationsResource);
/**
* Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes.
*/
redirectTo: string;
private get _proxy();
/**
* Fetch a DeactivationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance
*/
fetch(callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>;
/**
* Fetch a DeactivationsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance
*/
fetch(params: DeactivationsContextFetchOptions, callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>;
/**
* Fetch a DeactivationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DeactivationsInstance>) => any): Promise<ApiResponse<DeactivationsInstance>>;
/**
* Fetch a DeactivationsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DeactivationsInstance with HTTP metadata
*/
fetchWithHttpInfo(params: DeactivationsContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<DeactivationsInstance>) => any): Promise<ApiResponse<DeactivationsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
redirectTo: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DeactivationsSolution {
}
export interface DeactivationsListInstance {
_version: V1;
_solution: DeactivationsSolution;
_uri: string;
(): DeactivationsContext;
get(): DeactivationsContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DeactivationsListInstance(version: V1): DeactivationsListInstance;
export {};

View File

@@ -0,0 +1,141 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeactivationsInstance = exports.DeactivationsContextImpl = void 0;
exports.DeactivationsListInstance = DeactivationsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
class DeactivationsContextImpl {
constructor(_version) {
this._version = _version;
this._solution = {};
this._uri = `/Deactivations`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["date"] !== undefined)
data["Date"] = serialize.iso8601Date(params["date"]);
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new DeactivationsInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["date"] !== undefined)
data["Date"] = serialize.iso8601Date(params["date"]);
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new DeactivationsInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DeactivationsContextImpl = DeactivationsContextImpl;
class DeactivationsInstance {
constructor(_version, payload) {
this._version = _version;
this.redirectTo = payload.redirect_to;
this._solution = {};
}
get _proxy() {
this._context =
this._context || new DeactivationsContextImpl(this._version);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
redirectTo: this.redirectTo,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DeactivationsInstance = DeactivationsInstance;
function DeactivationsListInstance(version) {
const instance = (() => instance.get());
instance.get = function get() {
return new DeactivationsContextImpl(version);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,217 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to update a DomainCertsInstance
*/
export interface DomainCertsContextUpdateOptions {
/** Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain. */
tlsCert: string;
}
export interface DomainCertsContext {
/**
* Remove a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
/**
* Fetch a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Update a DomainCertsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
update(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
/**
* Update a DomainCertsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
updateWithHttpInfo(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DomainCertsContextSolution {
domainSid: string;
}
export declare class DomainCertsContextImpl implements DomainCertsContext {
protected _version: V1;
protected _solution: DomainCertsContextSolution;
protected _uri: string;
constructor(_version: V1, domainSid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
update(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
updateWithHttpInfo(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DomainCertsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DomainCertsResource {
domain_sid: string;
date_updated: Date;
date_expires: Date;
date_created: Date;
domain_name: string;
certificate_sid: string;
url: string;
cert_in_validation: any;
}
export declare class DomainCertsInstance {
protected _version: V1;
protected _solution: DomainCertsContextSolution;
protected _context?: DomainCertsContext;
constructor(_version: V1, payload: DomainCertsResource, domainSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
/**
* Date that this Domain was last updated.
*/
dateUpdated: Date;
/**
* Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work.
*/
dateExpires: Date;
/**
* Date that this Domain was registered to the Twilio platform to create a new Domain object.
*/
dateCreated: Date;
/**
* Full url path for this domain.
*/
domainName: string;
/**
* The unique string that we created to identify this Certificate resource.
*/
certificateSid: string;
url: string;
/**
* Optional JSON field describing the status and upload date of a new certificate in the process of validation
*/
certInValidation: any;
private get _proxy();
/**
* Remove a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
/**
* Fetch a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Update a DomainCertsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
update(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
/**
* Update a DomainCertsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
updateWithHttpInfo(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
dateUpdated: Date;
dateExpires: Date;
dateCreated: Date;
domainName: string;
certificateSid: string;
url: string;
certInValidation: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DomainCertsSolution {
}
export interface DomainCertsListInstance {
_version: V1;
_solution: DomainCertsSolution;
_uri: string;
(domainSid: string): DomainCertsContext;
get(domainSid: string): DomainCertsContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DomainCertsListInstance(version: V1): DomainCertsListInstance;
export {};

View File

@@ -0,0 +1,255 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainCertsInstance = exports.DomainCertsContextImpl = void 0;
exports.DomainCertsListInstance = DomainCertsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class DomainCertsContextImpl {
constructor(_version, domainSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(domainSid)) {
throw new Error("Parameter 'domainSid' is not valid.");
}
this._solution = { domainSid };
this._uri = `/LinkShortening/Domains/${domainSid}/Certificate`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new DomainCertsInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new DomainCertsInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["tlsCert"] === null || params["tlsCert"] === undefined) {
throw new Error("Required parameter \"params['tlsCert']\" missing.");
}
let data = {};
data["TlsCert"] = params["tlsCert"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new DomainCertsInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["tlsCert"] === null || params["tlsCert"] === undefined) {
throw new Error("Required parameter \"params['tlsCert']\" missing.");
}
let data = {};
data["TlsCert"] = params["tlsCert"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new DomainCertsInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainCertsContextImpl = DomainCertsContextImpl;
class DomainCertsInstance {
constructor(_version, payload, domainSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.dateExpires = deserialize.iso8601DateTime(payload.date_expires);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.domainName = payload.domain_name;
this.certificateSid = payload.certificate_sid;
this.url = payload.url;
this.certInValidation = payload.cert_in_validation;
this._solution = { domainSid: domainSid || this.domainSid };
}
get _proxy() {
this._context =
this._context ||
new DomainCertsContextImpl(this._version, this._solution.domainSid);
return this._context;
}
/**
* Remove a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
dateUpdated: this.dateUpdated,
dateExpires: this.dateExpires,
dateCreated: this.dateCreated,
domainName: this.domainName,
certificateSid: this.certificateSid,
url: this.url,
certInValidation: this.certInValidation,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainCertsInstance = DomainCertsInstance;
function DomainCertsListInstance(version) {
const instance = ((domainSid) => instance.get(domainSid));
instance.get = function get(domainSid) {
return new DomainCertsContextImpl(version, domainSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,227 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to update a DomainConfigInstance
*/
export interface DomainConfigContextUpdateOptions {
/** Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. */
fallbackUrl?: string;
/** URL to receive click events to your webhook whenever the recipients click on the shortened links */
callbackUrl?: string;
/** Boolean field to set customer delivery preference when there is a failure in linkShortening service */
continueOnFailure?: boolean;
/** Customer\\\'s choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. */
disableHttps?: boolean;
}
export interface DomainConfigContext {
/**
* Fetch a DomainConfigInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
fetch(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
/**
* Fetch a DomainConfigInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Update a DomainConfigInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
update(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
/**
* Update a DomainConfigInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
update(params: DomainConfigContextUpdateOptions, callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
/**
* Update a DomainConfigInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Update a DomainConfigInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
updateWithHttpInfo(params: DomainConfigContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DomainConfigContextSolution {
domainSid: string;
}
export declare class DomainConfigContextImpl implements DomainConfigContext {
protected _version: V1;
protected _solution: DomainConfigContextSolution;
protected _uri: string;
constructor(_version: V1, domainSid: string);
fetch(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
update(params?: DomainConfigContextUpdateOptions | ((error: Error | null, item?: DomainConfigInstance) => any), callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
updateWithHttpInfo(params?: DomainConfigContextUpdateOptions | ((error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DomainConfigContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DomainConfigResource {
domain_sid: string;
config_sid: string;
fallback_url: string;
callback_url: string;
continue_on_failure: boolean;
date_created: Date;
date_updated: Date;
url: string;
disable_https: boolean;
}
export declare class DomainConfigInstance {
protected _version: V1;
protected _solution: DomainConfigContextSolution;
protected _context?: DomainConfigContext;
constructor(_version: V1, payload: DomainConfigResource, domainSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
/**
* The unique string that we created to identify the Domain config (prefix ZK).
*/
configSid: string;
/**
* Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
*/
fallbackUrl: string;
/**
* URL to receive click events to your webhook whenever the recipients click on the shortened links.
*/
callbackUrl: string;
/**
* Boolean field to set customer delivery preference when there is a failure in linkShortening service
*/
continueOnFailure: boolean;
/**
* Date this Domain Config was created.
*/
dateCreated: Date;
/**
* Date that this Domain Config was last updated.
*/
dateUpdated: Date;
url: string;
/**
* Customer\'s choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.
*/
disableHttps: boolean;
private get _proxy();
/**
* Fetch a DomainConfigInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
fetch(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
/**
* Fetch a DomainConfigInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Update a DomainConfigInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
update(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
/**
* Update a DomainConfigInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
update(params: DomainConfigContextUpdateOptions, callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>;
/**
* Update a DomainConfigInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Update a DomainConfigInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
updateWithHttpInfo(params: DomainConfigContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<DomainConfigInstance>) => any): Promise<ApiResponse<DomainConfigInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
configSid: string;
fallbackUrl: string;
callbackUrl: string;
continueOnFailure: boolean;
dateCreated: Date;
dateUpdated: Date;
url: string;
disableHttps: boolean;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DomainConfigSolution {
}
export interface DomainConfigListInstance {
_version: V1;
_solution: DomainConfigSolution;
_uri: string;
(domainSid: string): DomainConfigContext;
get(domainSid: string): DomainConfigContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DomainConfigListInstance(version: V1): DomainConfigListInstance;
export {};

View File

@@ -0,0 +1,228 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainConfigInstance = exports.DomainConfigContextImpl = void 0;
exports.DomainConfigListInstance = DomainConfigListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class DomainConfigContextImpl {
constructor(_version, domainSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(domainSid)) {
throw new Error("Parameter 'domainSid' is not valid.");
}
this._solution = { domainSid };
this._uri = `/LinkShortening/Domains/${domainSid}/Config`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new DomainConfigInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new DomainConfigInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["fallbackUrl"] !== undefined)
data["FallbackUrl"] = params["fallbackUrl"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["continueOnFailure"] !== undefined)
data["ContinueOnFailure"] = serialize.bool(params["continueOnFailure"]);
if (params["disableHttps"] !== undefined)
data["DisableHttps"] = serialize.bool(params["disableHttps"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new DomainConfigInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["fallbackUrl"] !== undefined)
data["FallbackUrl"] = params["fallbackUrl"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["continueOnFailure"] !== undefined)
data["ContinueOnFailure"] = serialize.bool(params["continueOnFailure"]);
if (params["disableHttps"] !== undefined)
data["DisableHttps"] = serialize.bool(params["disableHttps"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new DomainConfigInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainConfigContextImpl = DomainConfigContextImpl;
class DomainConfigInstance {
constructor(_version, payload, domainSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.configSid = payload.config_sid;
this.fallbackUrl = payload.fallback_url;
this.callbackUrl = payload.callback_url;
this.continueOnFailure = payload.continue_on_failure;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.disableHttps = payload.disable_https;
this._solution = { domainSid: domainSid || this.domainSid };
}
get _proxy() {
this._context =
this._context ||
new DomainConfigContextImpl(this._version, this._solution.domainSid);
return this._context;
}
/**
* Fetch a DomainConfigInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a DomainConfigInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
configSid: this.configSid,
fallbackUrl: this.fallbackUrl,
callbackUrl: this.callbackUrl,
continueOnFailure: this.continueOnFailure,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
disableHttps: this.disableHttps,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainConfigInstance = DomainConfigInstance;
function DomainConfigListInstance(version) {
const instance = ((domainSid) => instance.get(domainSid));
instance.get = function get(domainSid) {
return new DomainConfigContextImpl(version, domainSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,144 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface DomainConfigMessagingServiceContext {
/**
* Fetch a DomainConfigMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigMessagingServiceInstance
*/
fetch(callback?: (error: Error | null, item?: DomainConfigMessagingServiceInstance) => any): Promise<DomainConfigMessagingServiceInstance>;
/**
* Fetch a DomainConfigMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigMessagingServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigMessagingServiceInstance>) => any): Promise<ApiResponse<DomainConfigMessagingServiceInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DomainConfigMessagingServiceContextSolution {
messagingServiceSid: string;
}
export declare class DomainConfigMessagingServiceContextImpl implements DomainConfigMessagingServiceContext {
protected _version: V1;
protected _solution: DomainConfigMessagingServiceContextSolution;
protected _uri: string;
constructor(_version: V1, messagingServiceSid: string);
fetch(callback?: (error: Error | null, item?: DomainConfigMessagingServiceInstance) => any): Promise<DomainConfigMessagingServiceInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigMessagingServiceInstance>) => any): Promise<ApiResponse<DomainConfigMessagingServiceInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DomainConfigMessagingServiceContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DomainConfigMessagingServiceResource {
domain_sid: string;
config_sid: string;
messaging_service_sid: string;
fallback_url: string;
callback_url: string;
continue_on_failure: boolean;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class DomainConfigMessagingServiceInstance {
protected _version: V1;
protected _solution: DomainConfigMessagingServiceContextSolution;
protected _context?: DomainConfigMessagingServiceContext;
constructor(_version: V1, payload: DomainConfigMessagingServiceResource, messagingServiceSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
/**
* The unique string that we created to identify the Domain config (prefix ZK).
*/
configSid: string;
/**
* The unique string that identifies the messaging service
*/
messagingServiceSid: string;
/**
* Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
*/
fallbackUrl: string;
/**
* URL to receive click events to your webhook whenever the recipients click on the shortened links.
*/
callbackUrl: string;
/**
* Boolean field to set customer delivery preference when there is a failure in linkShortening service
*/
continueOnFailure: boolean;
/**
* Date this Domain Config was created.
*/
dateCreated: Date;
/**
* Date that this Domain Config was last updated.
*/
dateUpdated: Date;
url: string;
private get _proxy();
/**
* Fetch a DomainConfigMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigMessagingServiceInstance
*/
fetch(callback?: (error: Error | null, item?: DomainConfigMessagingServiceInstance) => any): Promise<DomainConfigMessagingServiceInstance>;
/**
* Fetch a DomainConfigMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigMessagingServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainConfigMessagingServiceInstance>) => any): Promise<ApiResponse<DomainConfigMessagingServiceInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
configSid: string;
messagingServiceSid: string;
fallbackUrl: string;
callbackUrl: string;
continueOnFailure: boolean;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DomainConfigMessagingServiceSolution {
}
export interface DomainConfigMessagingServiceListInstance {
_version: V1;
_solution: DomainConfigMessagingServiceSolution;
_uri: string;
(messagingServiceSid: string): DomainConfigMessagingServiceContext;
get(messagingServiceSid: string): DomainConfigMessagingServiceContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DomainConfigMessagingServiceListInstance(version: V1): DomainConfigMessagingServiceListInstance;
export {};

View File

@@ -0,0 +1,156 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainConfigMessagingServiceInstance = exports.DomainConfigMessagingServiceContextImpl = void 0;
exports.DomainConfigMessagingServiceListInstance = DomainConfigMessagingServiceListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class DomainConfigMessagingServiceContextImpl {
constructor(_version, messagingServiceSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
this._solution = { messagingServiceSid };
this._uri = `/LinkShortening/MessagingService/${messagingServiceSid}/DomainConfig`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new DomainConfigMessagingServiceInstance(operationVersion, payload, instance._solution.messagingServiceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new DomainConfigMessagingServiceInstance(operationVersion, response.body, instance._solution.messagingServiceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainConfigMessagingServiceContextImpl = DomainConfigMessagingServiceContextImpl;
class DomainConfigMessagingServiceInstance {
constructor(_version, payload, messagingServiceSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.configSid = payload.config_sid;
this.messagingServiceSid = payload.messaging_service_sid;
this.fallbackUrl = payload.fallback_url;
this.callbackUrl = payload.callback_url;
this.continueOnFailure = payload.continue_on_failure;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = {
messagingServiceSid: messagingServiceSid || this.messagingServiceSid,
};
}
get _proxy() {
this._context =
this._context ||
new DomainConfigMessagingServiceContextImpl(this._version, this._solution.messagingServiceSid);
return this._context;
}
/**
* Fetch a DomainConfigMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigMessagingServiceInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a DomainConfigMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainConfigMessagingServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
configSid: this.configSid,
messagingServiceSid: this.messagingServiceSid,
fallbackUrl: this.fallbackUrl,
callbackUrl: this.callbackUrl,
continueOnFailure: this.continueOnFailure,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainConfigMessagingServiceInstance = DomainConfigMessagingServiceInstance;
function DomainConfigMessagingServiceListInstance(version) {
const instance = ((messagingServiceSid) => instance.get(messagingServiceSid));
instance.get = function get(messagingServiceSid) {
return new DomainConfigMessagingServiceContextImpl(version, messagingServiceSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,108 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface DomainValidateDnContext {
/**
* Fetch a DomainValidateDnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainValidateDnInstance
*/
fetch(callback?: (error: Error | null, item?: DomainValidateDnInstance) => any): Promise<DomainValidateDnInstance>;
/**
* Fetch a DomainValidateDnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainValidateDnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainValidateDnInstance>) => any): Promise<ApiResponse<DomainValidateDnInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DomainValidateDnContextSolution {
domainSid: string;
}
export declare class DomainValidateDnContextImpl implements DomainValidateDnContext {
protected _version: V1;
protected _solution: DomainValidateDnContextSolution;
protected _uri: string;
constructor(_version: V1, domainSid: string);
fetch(callback?: (error: Error | null, item?: DomainValidateDnInstance) => any): Promise<DomainValidateDnInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainValidateDnInstance>) => any): Promise<ApiResponse<DomainValidateDnInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DomainValidateDnContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DomainValidateDnResource {
domain_sid: string;
is_valid: boolean;
reason: string;
url: string;
}
export declare class DomainValidateDnInstance {
protected _version: V1;
protected _solution: DomainValidateDnContextSolution;
protected _context?: DomainValidateDnContext;
constructor(_version: V1, payload: DomainValidateDnResource, domainSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
isValid: boolean;
reason: string;
url: string;
private get _proxy();
/**
* Fetch a DomainValidateDnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainValidateDnInstance
*/
fetch(callback?: (error: Error | null, item?: DomainValidateDnInstance) => any): Promise<DomainValidateDnInstance>;
/**
* Fetch a DomainValidateDnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainValidateDnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainValidateDnInstance>) => any): Promise<ApiResponse<DomainValidateDnInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
isValid: boolean;
reason: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DomainValidateDnSolution {
}
export interface DomainValidateDnListInstance {
_version: V1;
_solution: DomainValidateDnSolution;
_uri: string;
(domainSid: string): DomainValidateDnContext;
get(domainSid: string): DomainValidateDnContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DomainValidateDnListInstance(version: V1): DomainValidateDnListInstance;
export {};

View File

@@ -0,0 +1,144 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainValidateDnInstance = exports.DomainValidateDnContextImpl = void 0;
exports.DomainValidateDnListInstance = DomainValidateDnListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class DomainValidateDnContextImpl {
constructor(_version, domainSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(domainSid)) {
throw new Error("Parameter 'domainSid' is not valid.");
}
this._solution = { domainSid };
this._uri = `/LinkShortening/Domains/${domainSid}/ValidateDns`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new DomainValidateDnInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new DomainValidateDnInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainValidateDnContextImpl = DomainValidateDnContextImpl;
class DomainValidateDnInstance {
constructor(_version, payload, domainSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.isValid = payload.is_valid;
this.reason = payload.reason;
this.url = payload.url;
this._solution = { domainSid: domainSid || this.domainSid };
}
get _proxy() {
this._context =
this._context ||
new DomainValidateDnContextImpl(this._version, this._solution.domainSid);
return this._context;
}
/**
* Fetch a DomainValidateDnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainValidateDnInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a DomainValidateDnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainValidateDnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
isValid: this.isValid,
reason: this.reason,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainValidateDnInstance = DomainValidateDnInstance;
function DomainValidateDnListInstance(version) {
const instance = ((domainSid) => instance.get(domainSid));
instance.get = function get(domainSid) {
return new DomainValidateDnContextImpl(version, domainSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,90 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to create a ExternalCampaignInstance
*/
export interface ExternalCampaignListInstanceCreateOptions {
/** ID of the preregistered campaign. */
campaignId: string;
/** The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. */
messagingServiceSid: string;
/** Customers should use this flag during the ERC registration process to indicate to Twilio that the campaign being registered is undergoing CNP migration. It is important for the user to first trigger the CNP migration process for said campaign in their CSP portal and have Twilio accept the sharing request, before making this api call. */
cnpMigration?: boolean;
}
export interface ExternalCampaignSolution {
}
export interface ExternalCampaignListInstance {
_version: V1;
_solution: ExternalCampaignSolution;
_uri: string;
/**
* Create a ExternalCampaignInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExternalCampaignInstance
*/
create(params: ExternalCampaignListInstanceCreateOptions, callback?: (error: Error | null, item?: ExternalCampaignInstance) => any): Promise<ExternalCampaignInstance>;
/**
* Create a ExternalCampaignInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExternalCampaignInstance with HTTP metadata
*/
createWithHttpInfo(params: ExternalCampaignListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ExternalCampaignInstance>) => any): Promise<ApiResponse<ExternalCampaignInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExternalCampaignListInstance(version: V1): ExternalCampaignListInstance;
interface ExternalCampaignResource {
sid: string;
account_sid: string;
campaign_id: string;
messaging_service_sid: string;
date_created: Date;
}
export declare class ExternalCampaignInstance {
protected _version: V1;
constructor(_version: V1, payload: ExternalCampaignResource);
/**
* The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to.
*/
accountSid: string;
/**
* ID of the preregistered campaign.
*/
campaignId: string;
/**
* The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.
*/
messagingServiceSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
campaignId: string;
messagingServiceSid: string;
dateCreated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,125 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExternalCampaignInstance = void 0;
exports.ExternalCampaignListInstance = ExternalCampaignListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function ExternalCampaignListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Services/PreregisteredUsa2p`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["campaignId"] === null || params["campaignId"] === undefined) {
throw new Error("Required parameter \"params['campaignId']\" missing.");
}
if (params["messagingServiceSid"] === null ||
params["messagingServiceSid"] === undefined) {
throw new Error("Required parameter \"params['messagingServiceSid']\" missing.");
}
let data = {};
data["CampaignId"] = params["campaignId"];
data["MessagingServiceSid"] = params["messagingServiceSid"];
if (params["cnpMigration"] !== undefined)
data["CnpMigration"] = serialize.bool(params["cnpMigration"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExternalCampaignInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["campaignId"] === null || params["campaignId"] === undefined) {
throw new Error("Required parameter \"params['campaignId']\" missing.");
}
if (params["messagingServiceSid"] === null ||
params["messagingServiceSid"] === undefined) {
throw new Error("Required parameter \"params['messagingServiceSid']\" missing.");
}
let data = {};
data["CampaignId"] = params["campaignId"];
data["MessagingServiceSid"] = params["messagingServiceSid"];
if (params["cnpMigration"] !== undefined)
data["CnpMigration"] = serialize.bool(params["cnpMigration"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ExternalCampaignInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ExternalCampaignInstance {
constructor(_version, payload) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.campaignId = payload.campaign_id;
this.messagingServiceSid = payload.messaging_service_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
campaignId: this.campaignId,
messagingServiceSid: this.messagingServiceSid,
dateCreated: this.dateCreated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExternalCampaignInstance = ExternalCampaignInstance;

View File

@@ -0,0 +1,143 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface LinkshorteningMessagingServiceContext {
/**
* Create a LinkshorteningMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceInstance
*/
create(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceInstance) => any): Promise<LinkshorteningMessagingServiceInstance>;
/**
* Create a LinkshorteningMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LinkshorteningMessagingServiceInstance>) => any): Promise<ApiResponse<LinkshorteningMessagingServiceInstance>>;
/**
* Remove a LinkshorteningMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a LinkshorteningMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface LinkshorteningMessagingServiceContextSolution {
domainSid: string;
messagingServiceSid: string;
}
export declare class LinkshorteningMessagingServiceContextImpl implements LinkshorteningMessagingServiceContext {
protected _version: V1;
protected _solution: LinkshorteningMessagingServiceContextSolution;
protected _uri: string;
constructor(_version: V1, domainSid: string, messagingServiceSid: string);
create(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceInstance) => any): Promise<LinkshorteningMessagingServiceInstance>;
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LinkshorteningMessagingServiceInstance>) => any): Promise<ApiResponse<LinkshorteningMessagingServiceInstance>>;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): LinkshorteningMessagingServiceContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface LinkshorteningMessagingServiceResource {
domain_sid: string;
messaging_service_sid: string;
url: string;
}
export declare class LinkshorteningMessagingServiceInstance {
protected _version: V1;
protected _solution: LinkshorteningMessagingServiceContextSolution;
protected _context?: LinkshorteningMessagingServiceContext;
constructor(_version: V1, payload: LinkshorteningMessagingServiceResource, domainSid?: string, messagingServiceSid?: string);
/**
* The unique string identifies the domain resource
*/
domainSid: string;
/**
* The unique string that identifies the messaging service
*/
messagingServiceSid: string;
url: string;
private get _proxy();
/**
* Create a LinkshorteningMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceInstance
*/
create(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceInstance) => any): Promise<LinkshorteningMessagingServiceInstance>;
/**
* Create a LinkshorteningMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LinkshorteningMessagingServiceInstance>) => any): Promise<ApiResponse<LinkshorteningMessagingServiceInstance>>;
/**
* Remove a LinkshorteningMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a LinkshorteningMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
messagingServiceSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface LinkshorteningMessagingServiceSolution {
}
export interface LinkshorteningMessagingServiceListInstance {
_version: V1;
_solution: LinkshorteningMessagingServiceSolution;
_uri: string;
(domainSid: string, messagingServiceSid: string): LinkshorteningMessagingServiceContext;
get(domainSid: string, messagingServiceSid: string): LinkshorteningMessagingServiceContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function LinkshorteningMessagingServiceListInstance(version: V1): LinkshorteningMessagingServiceListInstance;
export {};

View File

@@ -0,0 +1,193 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkshorteningMessagingServiceInstance = exports.LinkshorteningMessagingServiceContextImpl = void 0;
exports.LinkshorteningMessagingServiceListInstance = LinkshorteningMessagingServiceListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class LinkshorteningMessagingServiceContextImpl {
constructor(_version, domainSid, messagingServiceSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(domainSid)) {
throw new Error("Parameter 'domainSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
this._solution = { domainSid, messagingServiceSid };
this._uri = `/LinkShortening/Domains/${domainSid}/MessagingServices/${messagingServiceSid}`;
}
create(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new LinkshorteningMessagingServiceInstance(operationVersion, payload, instance._solution.domainSid, instance._solution.messagingServiceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
createWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new LinkshorteningMessagingServiceInstance(operationVersion, response.body, instance._solution.domainSid, instance._solution.messagingServiceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LinkshorteningMessagingServiceContextImpl = LinkshorteningMessagingServiceContextImpl;
class LinkshorteningMessagingServiceInstance {
constructor(_version, payload, domainSid, messagingServiceSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.messagingServiceSid = payload.messaging_service_sid;
this.url = payload.url;
this._solution = {
domainSid: domainSid || this.domainSid,
messagingServiceSid: messagingServiceSid || this.messagingServiceSid,
};
}
get _proxy() {
this._context =
this._context ||
new LinkshorteningMessagingServiceContextImpl(this._version, this._solution.domainSid, this._solution.messagingServiceSid);
return this._context;
}
/**
* Create a LinkshorteningMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceInstance
*/
create(callback) {
return this._proxy.create(callback);
}
/**
* Create a LinkshorteningMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceInstance with HTTP metadata
*/
createWithHttpInfo(callback) {
return this._proxy.createWithHttpInfo(callback);
}
/**
* Remove a LinkshorteningMessagingServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a LinkshorteningMessagingServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
messagingServiceSid: this.messagingServiceSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LinkshorteningMessagingServiceInstance = LinkshorteningMessagingServiceInstance;
function LinkshorteningMessagingServiceListInstance(version) {
const instance = ((domainSid, messagingServiceSid) => instance.get(domainSid, messagingServiceSid));
instance.get = function get(domainSid, messagingServiceSid) {
return new LinkshorteningMessagingServiceContextImpl(version, domainSid, messagingServiceSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,108 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface LinkshorteningMessagingServiceDomainAssociationContext {
/**
* Fetch a LinkshorteningMessagingServiceDomainAssociationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance
*/
fetch(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceDomainAssociationInstance) => any): Promise<LinkshorteningMessagingServiceDomainAssociationInstance>;
/**
* Fetch a LinkshorteningMessagingServiceDomainAssociationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LinkshorteningMessagingServiceDomainAssociationInstance>) => any): Promise<ApiResponse<LinkshorteningMessagingServiceDomainAssociationInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface LinkshorteningMessagingServiceDomainAssociationContextSolution {
messagingServiceSid: string;
}
export declare class LinkshorteningMessagingServiceDomainAssociationContextImpl implements LinkshorteningMessagingServiceDomainAssociationContext {
protected _version: V1;
protected _solution: LinkshorteningMessagingServiceDomainAssociationContextSolution;
protected _uri: string;
constructor(_version: V1, messagingServiceSid: string);
fetch(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceDomainAssociationInstance) => any): Promise<LinkshorteningMessagingServiceDomainAssociationInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LinkshorteningMessagingServiceDomainAssociationInstance>) => any): Promise<ApiResponse<LinkshorteningMessagingServiceDomainAssociationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): LinkshorteningMessagingServiceDomainAssociationContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface LinkshorteningMessagingServiceDomainAssociationResource {
domain_sid: string;
messaging_service_sid: string;
url: string;
}
export declare class LinkshorteningMessagingServiceDomainAssociationInstance {
protected _version: V1;
protected _solution: LinkshorteningMessagingServiceDomainAssociationContextSolution;
protected _context?: LinkshorteningMessagingServiceDomainAssociationContext;
constructor(_version: V1, payload: LinkshorteningMessagingServiceDomainAssociationResource, messagingServiceSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
/**
* The unique string that identifies the messaging service
*/
messagingServiceSid: string;
url: string;
private get _proxy();
/**
* Fetch a LinkshorteningMessagingServiceDomainAssociationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance
*/
fetch(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceDomainAssociationInstance) => any): Promise<LinkshorteningMessagingServiceDomainAssociationInstance>;
/**
* Fetch a LinkshorteningMessagingServiceDomainAssociationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LinkshorteningMessagingServiceDomainAssociationInstance>) => any): Promise<ApiResponse<LinkshorteningMessagingServiceDomainAssociationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
messagingServiceSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface LinkshorteningMessagingServiceDomainAssociationSolution {
}
export interface LinkshorteningMessagingServiceDomainAssociationListInstance {
_version: V1;
_solution: LinkshorteningMessagingServiceDomainAssociationSolution;
_uri: string;
(messagingServiceSid: string): LinkshorteningMessagingServiceDomainAssociationContext;
get(messagingServiceSid: string): LinkshorteningMessagingServiceDomainAssociationContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function LinkshorteningMessagingServiceDomainAssociationListInstance(version: V1): LinkshorteningMessagingServiceDomainAssociationListInstance;
export {};

View File

@@ -0,0 +1,140 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkshorteningMessagingServiceDomainAssociationInstance = exports.LinkshorteningMessagingServiceDomainAssociationContextImpl = void 0;
exports.LinkshorteningMessagingServiceDomainAssociationListInstance = LinkshorteningMessagingServiceDomainAssociationListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class LinkshorteningMessagingServiceDomainAssociationContextImpl {
constructor(_version, messagingServiceSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
this._solution = { messagingServiceSid };
this._uri = `/LinkShortening/MessagingServices/${messagingServiceSid}/Domain`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new LinkshorteningMessagingServiceDomainAssociationInstance(operationVersion, payload, instance._solution.messagingServiceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({ uri: instance._uri, method: "get", headers })
.then((response) => ({
...response,
body: new LinkshorteningMessagingServiceDomainAssociationInstance(operationVersion, response.body, instance._solution.messagingServiceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LinkshorteningMessagingServiceDomainAssociationContextImpl = LinkshorteningMessagingServiceDomainAssociationContextImpl;
class LinkshorteningMessagingServiceDomainAssociationInstance {
constructor(_version, payload, messagingServiceSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.messagingServiceSid = payload.messaging_service_sid;
this.url = payload.url;
this._solution = {
messagingServiceSid: messagingServiceSid || this.messagingServiceSid,
};
}
get _proxy() {
this._context =
this._context ||
new LinkshorteningMessagingServiceDomainAssociationContextImpl(this._version, this._solution.messagingServiceSid);
return this._context;
}
/**
* Fetch a LinkshorteningMessagingServiceDomainAssociationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a LinkshorteningMessagingServiceDomainAssociationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
messagingServiceSid: this.messagingServiceSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LinkshorteningMessagingServiceDomainAssociationInstance = LinkshorteningMessagingServiceDomainAssociationInstance;
function LinkshorteningMessagingServiceDomainAssociationListInstance(version) {
const instance = ((messagingServiceSid) => instance.get(messagingServiceSid));
instance.get = function get(messagingServiceSid) {
return new LinkshorteningMessagingServiceDomainAssociationContextImpl(version, messagingServiceSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,144 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface RequestManagedCertContext {
/**
* Update a RequestManagedCertInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RequestManagedCertInstance
*/
update(callback?: (error: Error | null, item?: RequestManagedCertInstance) => any): Promise<RequestManagedCertInstance>;
/**
* Update a RequestManagedCertInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RequestManagedCertInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RequestManagedCertInstance>) => any): Promise<ApiResponse<RequestManagedCertInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface RequestManagedCertContextSolution {
domainSid: string;
}
export declare class RequestManagedCertContextImpl implements RequestManagedCertContext {
protected _version: V1;
protected _solution: RequestManagedCertContextSolution;
protected _uri: string;
constructor(_version: V1, domainSid: string);
update(callback?: (error: Error | null, item?: RequestManagedCertInstance) => any): Promise<RequestManagedCertInstance>;
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RequestManagedCertInstance>) => any): Promise<ApiResponse<RequestManagedCertInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): RequestManagedCertContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface RequestManagedCertResource {
domain_sid: string;
date_updated: Date;
date_created: Date;
date_expires: Date;
domain_name: string;
certificate_sid: string;
url: string;
managed: boolean;
requesting: boolean;
}
export declare class RequestManagedCertInstance {
protected _version: V1;
protected _solution: RequestManagedCertContextSolution;
protected _context?: RequestManagedCertContext;
constructor(_version: V1, payload: RequestManagedCertResource, domainSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
/**
* Date that this Domain was last updated.
*/
dateUpdated: Date;
/**
* Date that this Domain was registered to the Twilio platform to create a new Domain object.
*/
dateCreated: Date;
/**
* Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert.
*/
dateExpires: Date;
/**
* Full url path for this domain.
*/
domainName: string;
/**
* The unique string that we created to identify this Certificate resource.
*/
certificateSid: string;
url: string;
/**
* A boolean flag indicating if the certificate is managed by Twilio.
*/
managed: boolean;
/**
* A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio.
*/
requesting: boolean;
private get _proxy();
/**
* Update a RequestManagedCertInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RequestManagedCertInstance
*/
update(callback?: (error: Error | null, item?: RequestManagedCertInstance) => any): Promise<RequestManagedCertInstance>;
/**
* Update a RequestManagedCertInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RequestManagedCertInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RequestManagedCertInstance>) => any): Promise<ApiResponse<RequestManagedCertInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
dateUpdated: Date;
dateCreated: Date;
dateExpires: Date;
domainName: string;
certificateSid: string;
url: string;
managed: boolean;
requesting: boolean;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface RequestManagedCertSolution {
}
export interface RequestManagedCertListInstance {
_version: V1;
_solution: RequestManagedCertSolution;
_uri: string;
(domainSid: string): RequestManagedCertContext;
get(domainSid: string): RequestManagedCertContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function RequestManagedCertListInstance(version: V1): RequestManagedCertListInstance;
export {};

View File

@@ -0,0 +1,154 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestManagedCertInstance = exports.RequestManagedCertContextImpl = void 0;
exports.RequestManagedCertListInstance = RequestManagedCertListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class RequestManagedCertContextImpl {
constructor(_version, domainSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(domainSid)) {
throw new Error("Parameter 'domainSid' is not valid.");
}
this._solution = { domainSid };
this._uri = `/LinkShortening/Domains/${domainSid}/RequestManagedCert`;
}
update(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new RequestManagedCertInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new RequestManagedCertInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RequestManagedCertContextImpl = RequestManagedCertContextImpl;
class RequestManagedCertInstance {
constructor(_version, payload, domainSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateExpires = deserialize.iso8601DateTime(payload.date_expires);
this.domainName = payload.domain_name;
this.certificateSid = payload.certificate_sid;
this.url = payload.url;
this.managed = payload.managed;
this.requesting = payload.requesting;
this._solution = { domainSid: domainSid || this.domainSid };
}
get _proxy() {
this._context =
this._context ||
new RequestManagedCertContextImpl(this._version, this._solution.domainSid);
return this._context;
}
/**
* Update a RequestManagedCertInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RequestManagedCertInstance
*/
update(callback) {
return this._proxy.update(callback);
}
/**
* Update a RequestManagedCertInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RequestManagedCertInstance with HTTP metadata
*/
updateWithHttpInfo(callback) {
return this._proxy.updateWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
dateUpdated: this.dateUpdated,
dateCreated: this.dateCreated,
dateExpires: this.dateExpires,
domainName: this.domainName,
certificateSid: this.certificateSid,
url: this.url,
managed: this.managed,
requesting: this.requesting,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RequestManagedCertInstance = RequestManagedCertInstance;
function RequestManagedCertListInstance(version) {
const instance = ((domainSid) => instance.get(domainSid));
instance.get = function get(domainSid) {
return new RequestManagedCertContextImpl(version, domainSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

641
node_modules/twilio/lib/rest/messaging/v1/service.d.ts generated vendored Normal file
View File

@@ -0,0 +1,641 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { AlphaSenderListInstance } from "./service/alphaSender";
import { ChannelSenderListInstance } from "./service/channelSender";
import { DestinationAlphaSenderListInstance } from "./service/destinationAlphaSender";
import { PhoneNumberListInstance } from "./service/phoneNumber";
import { ShortCodeListInstance } from "./service/shortCode";
import { UsAppToPersonListInstance } from "./service/usAppToPerson";
import { UsAppToPersonUsecaseListInstance } from "./service/usAppToPersonUsecase";
/**
* Reserved.
*/
export type ServiceScanMessageContent = "inherit" | "enable" | "disable";
/**
* Options to pass to update a ServiceInstance
*/
export interface ServiceContextUpdateOptions {
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
/** The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. */
inboundRequestUrl?: string;
/** The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. */
inboundMethod?: string;
/** The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. */
fallbackUrl?: string;
/** The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. */
fallbackMethod?: string;
/** The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. */
statusCallback?: string;
/** Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. */
stickySender?: boolean;
/** Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. */
mmsConverter?: boolean;
/** Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. */
smartEncoding?: boolean;
/** */
scanMessageContent?: ServiceScanMessageContent;
/** [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. */
fallbackToLongCode?: boolean;
/** Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */
areaCodeGeomatch?: boolean;
/** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. */
validityPeriod?: number;
/** Reserved. */
synchronousValidation?: boolean;
/** A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. */
usecase?: string;
/** A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. */
useInboundWebhookOnNumber?: boolean;
}
/**
* Options to pass to create a ServiceInstance
*/
export interface ServiceListInstanceCreateOptions {
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName: string;
/** The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. */
inboundRequestUrl?: string;
/** The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. */
inboundMethod?: string;
/** The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. */
fallbackUrl?: string;
/** The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. */
fallbackMethod?: string;
/** The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. */
statusCallback?: string;
/** Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. */
stickySender?: boolean;
/** Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. */
mmsConverter?: boolean;
/** Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. */
smartEncoding?: boolean;
/** */
scanMessageContent?: ServiceScanMessageContent;
/** [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. */
fallbackToLongCode?: boolean;
/** Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */
areaCodeGeomatch?: boolean;
/** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. */
validityPeriod?: number;
/** Reserved. */
synchronousValidation?: boolean;
/** A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. */
usecase?: string;
/** A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. */
useInboundWebhookOnNumber?: boolean;
}
/**
* Options to pass to each
*/
export interface ServiceListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ServiceInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ServiceListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ServiceListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ServiceContext {
alphaSenders: AlphaSenderListInstance;
channelSenders: ChannelSenderListInstance;
destinationAlphaSenders: DestinationAlphaSenderListInstance;
phoneNumbers: PhoneNumberListInstance;
shortCodes: ShortCodeListInstance;
usAppToPerson: UsAppToPersonListInstance;
usAppToPersonUsecases: UsAppToPersonUsecaseListInstance;
/**
* Remove a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Fetch a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ServiceContextSolution {
sid: string;
}
export declare class ServiceContextImpl implements ServiceContext {
protected _version: V1;
protected _solution: ServiceContextSolution;
protected _uri: string;
protected _alphaSenders?: AlphaSenderListInstance;
protected _channelSenders?: ChannelSenderListInstance;
protected _destinationAlphaSenders?: DestinationAlphaSenderListInstance;
protected _phoneNumbers?: PhoneNumberListInstance;
protected _shortCodes?: ShortCodeListInstance;
protected _usAppToPerson?: UsAppToPersonListInstance;
protected _usAppToPersonUsecases?: UsAppToPersonUsecaseListInstance;
constructor(_version: V1, sid: string);
get alphaSenders(): AlphaSenderListInstance;
get channelSenders(): ChannelSenderListInstance;
get destinationAlphaSenders(): DestinationAlphaSenderListInstance;
get phoneNumbers(): PhoneNumberListInstance;
get shortCodes(): ShortCodeListInstance;
get usAppToPerson(): UsAppToPersonListInstance;
get usAppToPersonUsecases(): UsAppToPersonUsecaseListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
updateWithHttpInfo(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ApiResponse<ServiceInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ServiceContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ServicePayload extends TwilioResponsePayload {
services: ServiceResource[];
}
interface ServiceResource {
sid: string;
account_sid: string;
friendly_name: string;
date_created: Date;
date_updated: Date;
inbound_request_url: string;
inbound_method: string;
fallback_url: string;
fallback_method: string;
status_callback: string;
sticky_sender: boolean;
mms_converter: boolean;
smart_encoding: boolean;
scan_message_content: ServiceScanMessageContent;
fallback_to_long_code: boolean;
area_code_geomatch: boolean;
synchronous_validation: boolean;
validity_period: number;
url: string;
links: Record<string, string>;
usecase: string;
us_app_to_person_registered: boolean;
use_inbound_webhook_on_number: boolean;
}
export declare class ServiceInstance {
protected _version: V1;
protected _solution: ServiceContextSolution;
protected _context?: ServiceContext;
constructor(_version: V1, payload: ServiceResource, sid?: string);
/**
* The unique string that we created to identify the Service resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service.
*/
inboundRequestUrl: string;
/**
* The HTTP method we use to call `inbound_request_url`. Can be `GET` or `POST`.
*/
inboundMethod: string;
/**
* The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service.
*/
fallbackUrl: string;
/**
* The HTTP method we use to call `fallback_url`. Can be: `GET` or `POST`.
*/
fallbackMethod: string;
/**
* The URL we call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery.
*/
statusCallback: string;
/**
* Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance.
*/
stickySender: boolean;
/**
* Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance.
*/
mmsConverter: boolean;
/**
* Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance.
*/
smartEncoding: boolean;
scanMessageContent: ServiceScanMessageContent;
/**
* [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.
*/
fallbackToLongCode: boolean;
/**
* Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance.
*/
areaCodeGeomatch: boolean;
/**
* Reserved.
*/
synchronousValidation: boolean;
/**
* How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`.
*/
validityPeriod: number;
/**
* The absolute URL of the Service resource.
*/
url: string;
/**
* The absolute URLs of related resources.
*/
links: Record<string, string>;
/**
* A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`.
*/
usecase: string;
/**
* Whether US A2P campaign is registered for this Service.
*/
usAppToPersonRegistered: boolean;
/**
* A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service.
*/
useInboundWebhookOnNumber: boolean;
private get _proxy();
/**
* Remove a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Fetch a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Access the alphaSenders.
*/
alphaSenders(): AlphaSenderListInstance;
/**
* Access the channelSenders.
*/
channelSenders(): ChannelSenderListInstance;
/**
* Access the destinationAlphaSenders.
*/
destinationAlphaSenders(): DestinationAlphaSenderListInstance;
/**
* Access the phoneNumbers.
*/
phoneNumbers(): PhoneNumberListInstance;
/**
* Access the shortCodes.
*/
shortCodes(): ShortCodeListInstance;
/**
* Access the usAppToPerson.
*/
usAppToPerson(): UsAppToPersonListInstance;
/**
* Access the usAppToPersonUsecases.
*/
usAppToPersonUsecases(): UsAppToPersonUsecaseListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
dateCreated: Date;
dateUpdated: Date;
inboundRequestUrl: string;
inboundMethod: string;
fallbackUrl: string;
fallbackMethod: string;
statusCallback: string;
stickySender: boolean;
mmsConverter: boolean;
smartEncoding: boolean;
scanMessageContent: ServiceScanMessageContent;
fallbackToLongCode: boolean;
areaCodeGeomatch: boolean;
synchronousValidation: boolean;
validityPeriod: number;
url: string;
links: Record<string, string>;
usecase: string;
usAppToPersonRegistered: boolean;
useInboundWebhookOnNumber: boolean;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ServiceSolution {
}
export interface ServiceListInstance {
_version: V1;
_solution: ServiceSolution;
_uri: string;
(sid: string): ServiceContext;
get(sid: string): ServiceContext;
/**
* Create a ServiceInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Create a ServiceInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
createWithHttpInfo(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Streams ServiceInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ServiceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ServiceInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ServiceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ServiceInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
/**
* Retrieve a single target page of ServiceInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
/**
* Lists ServiceInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ServiceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>;
list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>;
/**
* Lists ServiceInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ServiceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ServiceInstance[]>) => any): Promise<ApiResponse<ServiceInstance[]>>;
listWithHttpInfo(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ServiceInstance[]>) => any): Promise<ApiResponse<ServiceInstance[]>>;
/**
* Retrieve a single page of ServiceInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ServiceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
/**
* Retrieve a single page of ServiceInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ServiceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
pageWithHttpInfo(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ServiceListInstance(version: V1): ServiceListInstance;
export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> {
/**
* Initialize the ServicePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ServiceSolution);
/**
* Build an instance of ServiceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ServiceResource): ServiceInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

666
node_modules/twilio/lib/rest/messaging/v1/service.js generated vendored Normal file
View File

@@ -0,0 +1,666 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServicePage = exports.ServiceInstance = exports.ServiceContextImpl = void 0;
exports.ServiceListInstance = ServiceListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const alphaSender_1 = require("./service/alphaSender");
const channelSender_1 = require("./service/channelSender");
const destinationAlphaSender_1 = require("./service/destinationAlphaSender");
const phoneNumber_1 = require("./service/phoneNumber");
const shortCode_1 = require("./service/shortCode");
const usAppToPerson_1 = require("./service/usAppToPerson");
const usAppToPersonUsecase_1 = require("./service/usAppToPersonUsecase");
class ServiceContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Services/${sid}`;
}
get alphaSenders() {
this._alphaSenders =
this._alphaSenders ||
(0, alphaSender_1.AlphaSenderListInstance)(this._version, this._solution.sid);
return this._alphaSenders;
}
get channelSenders() {
this._channelSenders =
this._channelSenders ||
(0, channelSender_1.ChannelSenderListInstance)(this._version, this._solution.sid);
return this._channelSenders;
}
get destinationAlphaSenders() {
this._destinationAlphaSenders =
this._destinationAlphaSenders ||
(0, destinationAlphaSender_1.DestinationAlphaSenderListInstance)(this._version, this._solution.sid);
return this._destinationAlphaSenders;
}
get phoneNumbers() {
this._phoneNumbers =
this._phoneNumbers ||
(0, phoneNumber_1.PhoneNumberListInstance)(this._version, this._solution.sid);
return this._phoneNumbers;
}
get shortCodes() {
this._shortCodes =
this._shortCodes ||
(0, shortCode_1.ShortCodeListInstance)(this._version, this._solution.sid);
return this._shortCodes;
}
get usAppToPerson() {
this._usAppToPerson =
this._usAppToPerson ||
(0, usAppToPerson_1.UsAppToPersonListInstance)(this._version, this._solution.sid);
return this._usAppToPerson;
}
get usAppToPersonUsecases() {
this._usAppToPersonUsecases =
this._usAppToPersonUsecases ||
(0, usAppToPersonUsecase_1.UsAppToPersonUsecaseListInstance)(this._version, this._solution.sid);
return this._usAppToPersonUsecases;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ServiceInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["inboundRequestUrl"] !== undefined)
data["InboundRequestUrl"] = params["inboundRequestUrl"];
if (params["inboundMethod"] !== undefined)
data["InboundMethod"] = params["inboundMethod"];
if (params["fallbackUrl"] !== undefined)
data["FallbackUrl"] = params["fallbackUrl"];
if (params["fallbackMethod"] !== undefined)
data["FallbackMethod"] = params["fallbackMethod"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["stickySender"] !== undefined)
data["StickySender"] = serialize.bool(params["stickySender"]);
if (params["mmsConverter"] !== undefined)
data["MmsConverter"] = serialize.bool(params["mmsConverter"]);
if (params["smartEncoding"] !== undefined)
data["SmartEncoding"] = serialize.bool(params["smartEncoding"]);
if (params["scanMessageContent"] !== undefined)
data["ScanMessageContent"] = params["scanMessageContent"];
if (params["fallbackToLongCode"] !== undefined)
data["FallbackToLongCode"] = serialize.bool(params["fallbackToLongCode"]);
if (params["areaCodeGeomatch"] !== undefined)
data["AreaCodeGeomatch"] = serialize.bool(params["areaCodeGeomatch"]);
if (params["validityPeriod"] !== undefined)
data["ValidityPeriod"] = params["validityPeriod"];
if (params["synchronousValidation"] !== undefined)
data["SynchronousValidation"] = serialize.bool(params["synchronousValidation"]);
if (params["usecase"] !== undefined)
data["Usecase"] = params["usecase"];
if (params["useInboundWebhookOnNumber"] !== undefined)
data["UseInboundWebhookOnNumber"] = serialize.bool(params["useInboundWebhookOnNumber"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["inboundRequestUrl"] !== undefined)
data["InboundRequestUrl"] = params["inboundRequestUrl"];
if (params["inboundMethod"] !== undefined)
data["InboundMethod"] = params["inboundMethod"];
if (params["fallbackUrl"] !== undefined)
data["FallbackUrl"] = params["fallbackUrl"];
if (params["fallbackMethod"] !== undefined)
data["FallbackMethod"] = params["fallbackMethod"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["stickySender"] !== undefined)
data["StickySender"] = serialize.bool(params["stickySender"]);
if (params["mmsConverter"] !== undefined)
data["MmsConverter"] = serialize.bool(params["mmsConverter"]);
if (params["smartEncoding"] !== undefined)
data["SmartEncoding"] = serialize.bool(params["smartEncoding"]);
if (params["scanMessageContent"] !== undefined)
data["ScanMessageContent"] = params["scanMessageContent"];
if (params["fallbackToLongCode"] !== undefined)
data["FallbackToLongCode"] = serialize.bool(params["fallbackToLongCode"]);
if (params["areaCodeGeomatch"] !== undefined)
data["AreaCodeGeomatch"] = serialize.bool(params["areaCodeGeomatch"]);
if (params["validityPeriod"] !== undefined)
data["ValidityPeriod"] = params["validityPeriod"];
if (params["synchronousValidation"] !== undefined)
data["SynchronousValidation"] = serialize.bool(params["synchronousValidation"]);
if (params["usecase"] !== undefined)
data["Usecase"] = params["usecase"];
if (params["useInboundWebhookOnNumber"] !== undefined)
data["UseInboundWebhookOnNumber"] = serialize.bool(params["useInboundWebhookOnNumber"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ServiceInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ServiceContextImpl = ServiceContextImpl;
class ServiceInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.inboundRequestUrl = payload.inbound_request_url;
this.inboundMethod = payload.inbound_method;
this.fallbackUrl = payload.fallback_url;
this.fallbackMethod = payload.fallback_method;
this.statusCallback = payload.status_callback;
this.stickySender = payload.sticky_sender;
this.mmsConverter = payload.mms_converter;
this.smartEncoding = payload.smart_encoding;
this.scanMessageContent = payload.scan_message_content;
this.fallbackToLongCode = payload.fallback_to_long_code;
this.areaCodeGeomatch = payload.area_code_geomatch;
this.synchronousValidation = payload.synchronous_validation;
this.validityPeriod = deserialize.integer(payload.validity_period);
this.url = payload.url;
this.links = payload.links;
this.usecase = payload.usecase;
this.usAppToPersonRegistered = payload.us_app_to_person_registered;
this.useInboundWebhookOnNumber = payload.use_inbound_webhook_on_number;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ServiceContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the alphaSenders.
*/
alphaSenders() {
return this._proxy.alphaSenders;
}
/**
* Access the channelSenders.
*/
channelSenders() {
return this._proxy.channelSenders;
}
/**
* Access the destinationAlphaSenders.
*/
destinationAlphaSenders() {
return this._proxy.destinationAlphaSenders;
}
/**
* Access the phoneNumbers.
*/
phoneNumbers() {
return this._proxy.phoneNumbers;
}
/**
* Access the shortCodes.
*/
shortCodes() {
return this._proxy.shortCodes;
}
/**
* Access the usAppToPerson.
*/
usAppToPerson() {
return this._proxy.usAppToPerson;
}
/**
* Access the usAppToPersonUsecases.
*/
usAppToPersonUsecases() {
return this._proxy.usAppToPersonUsecases;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
inboundRequestUrl: this.inboundRequestUrl,
inboundMethod: this.inboundMethod,
fallbackUrl: this.fallbackUrl,
fallbackMethod: this.fallbackMethod,
statusCallback: this.statusCallback,
stickySender: this.stickySender,
mmsConverter: this.mmsConverter,
smartEncoding: this.smartEncoding,
scanMessageContent: this.scanMessageContent,
fallbackToLongCode: this.fallbackToLongCode,
areaCodeGeomatch: this.areaCodeGeomatch,
synchronousValidation: this.synchronousValidation,
validityPeriod: this.validityPeriod,
url: this.url,
links: this.links,
usecase: this.usecase,
usAppToPersonRegistered: this.usAppToPersonRegistered,
useInboundWebhookOnNumber: this.useInboundWebhookOnNumber,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ServiceInstance = ServiceInstance;
function ServiceListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ServiceContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Services`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
if (params["inboundRequestUrl"] !== undefined)
data["InboundRequestUrl"] = params["inboundRequestUrl"];
if (params["inboundMethod"] !== undefined)
data["InboundMethod"] = params["inboundMethod"];
if (params["fallbackUrl"] !== undefined)
data["FallbackUrl"] = params["fallbackUrl"];
if (params["fallbackMethod"] !== undefined)
data["FallbackMethod"] = params["fallbackMethod"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["stickySender"] !== undefined)
data["StickySender"] = serialize.bool(params["stickySender"]);
if (params["mmsConverter"] !== undefined)
data["MmsConverter"] = serialize.bool(params["mmsConverter"]);
if (params["smartEncoding"] !== undefined)
data["SmartEncoding"] = serialize.bool(params["smartEncoding"]);
if (params["scanMessageContent"] !== undefined)
data["ScanMessageContent"] = params["scanMessageContent"];
if (params["fallbackToLongCode"] !== undefined)
data["FallbackToLongCode"] = serialize.bool(params["fallbackToLongCode"]);
if (params["areaCodeGeomatch"] !== undefined)
data["AreaCodeGeomatch"] = serialize.bool(params["areaCodeGeomatch"]);
if (params["validityPeriod"] !== undefined)
data["ValidityPeriod"] = params["validityPeriod"];
if (params["synchronousValidation"] !== undefined)
data["SynchronousValidation"] = serialize.bool(params["synchronousValidation"]);
if (params["usecase"] !== undefined)
data["Usecase"] = params["usecase"];
if (params["useInboundWebhookOnNumber"] !== undefined)
data["UseInboundWebhookOnNumber"] = serialize.bool(params["useInboundWebhookOnNumber"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
if (params["inboundRequestUrl"] !== undefined)
data["InboundRequestUrl"] = params["inboundRequestUrl"];
if (params["inboundMethod"] !== undefined)
data["InboundMethod"] = params["inboundMethod"];
if (params["fallbackUrl"] !== undefined)
data["FallbackUrl"] = params["fallbackUrl"];
if (params["fallbackMethod"] !== undefined)
data["FallbackMethod"] = params["fallbackMethod"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["stickySender"] !== undefined)
data["StickySender"] = serialize.bool(params["stickySender"]);
if (params["mmsConverter"] !== undefined)
data["MmsConverter"] = serialize.bool(params["mmsConverter"]);
if (params["smartEncoding"] !== undefined)
data["SmartEncoding"] = serialize.bool(params["smartEncoding"]);
if (params["scanMessageContent"] !== undefined)
data["ScanMessageContent"] = params["scanMessageContent"];
if (params["fallbackToLongCode"] !== undefined)
data["FallbackToLongCode"] = serialize.bool(params["fallbackToLongCode"]);
if (params["areaCodeGeomatch"] !== undefined)
data["AreaCodeGeomatch"] = serialize.bool(params["areaCodeGeomatch"]);
if (params["validityPeriod"] !== undefined)
data["ValidityPeriod"] = params["validityPeriod"];
if (params["synchronousValidation"] !== undefined)
data["SynchronousValidation"] = serialize.bool(params["synchronousValidation"]);
if (params["usecase"] !== undefined)
data["Usecase"] = params["usecase"];
if (params["useInboundWebhookOnNumber"] !== undefined)
data["UseInboundWebhookOnNumber"] = serialize.bool(params["useInboundWebhookOnNumber"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ServiceInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ServicePage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ServicePage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ServicePage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ServicePage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ServicePage extends Page_1.default {
/**
* Initialize the ServicePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ServiceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ServiceInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ServicePage = ServicePage;

View File

@@ -0,0 +1,359 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a AlphaSenderInstance
*/
export interface AlphaSenderListInstanceCreateOptions {
/** The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. */
alphaSender: string;
}
/**
* Options to pass to each
*/
export interface AlphaSenderListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface AlphaSenderListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface AlphaSenderListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface AlphaSenderContext {
/**
* Remove a AlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a AlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance
*/
fetch(callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>;
/**
* Fetch a AlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AlphaSenderInstance>) => any): Promise<ApiResponse<AlphaSenderInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AlphaSenderContextSolution {
serviceSid: string;
sid: string;
}
export declare class AlphaSenderContextImpl implements AlphaSenderContext {
protected _version: V1;
protected _solution: AlphaSenderContextSolution;
protected _uri: string;
constructor(_version: V1, serviceSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AlphaSenderInstance>) => any): Promise<ApiResponse<AlphaSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AlphaSenderContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AlphaSenderPayload extends TwilioResponsePayload {
alpha_senders: AlphaSenderResource[];
}
interface AlphaSenderResource {
sid: string;
account_sid: string;
service_sid: string;
date_created: Date;
date_updated: Date;
alpha_sender: string;
capabilities: Array<string>;
url: string;
}
export declare class AlphaSenderInstance {
protected _version: V1;
protected _solution: AlphaSenderContextSolution;
protected _context?: AlphaSenderContext;
constructor(_version: V1, payload: AlphaSenderResource, serviceSid: string, sid?: string);
/**
* The unique string that we created to identify the AlphaSender resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource.
*/
accountSid: string;
/**
* The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
*/
serviceSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The Alphanumeric Sender ID string.
*/
alphaSender: string;
/**
* An array of values that describe whether the number can receive calls or messages. Can be: `SMS`.
*/
capabilities: Array<string>;
/**
* The absolute URL of the AlphaSender resource.
*/
url: string;
private get _proxy();
/**
* Remove a AlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a AlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance
*/
fetch(callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>;
/**
* Fetch a AlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AlphaSenderInstance>) => any): Promise<ApiResponse<AlphaSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
serviceSid: string;
dateCreated: Date;
dateUpdated: Date;
alphaSender: string;
capabilities: string[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AlphaSenderSolution {
serviceSid: string;
}
export interface AlphaSenderListInstance {
_version: V1;
_solution: AlphaSenderSolution;
_uri: string;
(sid: string): AlphaSenderContext;
get(sid: string): AlphaSenderContext;
/**
* Create a AlphaSenderInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance
*/
create(params: AlphaSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>;
/**
* Create a AlphaSenderInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance with HTTP metadata
*/
createWithHttpInfo(params: AlphaSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<AlphaSenderInstance>) => any): Promise<ApiResponse<AlphaSenderInstance>>;
/**
* Streams AlphaSenderInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AlphaSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void): void;
each(params: AlphaSenderListInstanceEachOptions, callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AlphaSenderInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AlphaSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AlphaSenderListInstanceEachOptions, callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AlphaSenderInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: AlphaSenderPage) => any): Promise<AlphaSenderPage>;
/**
* Retrieve a single target page of AlphaSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<AlphaSenderPage>) => any): Promise<ApiResponse<AlphaSenderPage>>;
/**
* Lists AlphaSenderInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AlphaSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AlphaSenderInstance[]) => any): Promise<AlphaSenderInstance[]>;
list(params: AlphaSenderListInstanceOptions, callback?: (error: Error | null, items: AlphaSenderInstance[]) => any): Promise<AlphaSenderInstance[]>;
/**
* Lists AlphaSenderInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AlphaSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AlphaSenderInstance[]>) => any): Promise<ApiResponse<AlphaSenderInstance[]>>;
listWithHttpInfo(params: AlphaSenderListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AlphaSenderInstance[]>) => any): Promise<ApiResponse<AlphaSenderInstance[]>>;
/**
* Retrieve a single page of AlphaSenderInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AlphaSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AlphaSenderPage) => any): Promise<AlphaSenderPage>;
page(params: AlphaSenderListInstancePageOptions, callback?: (error: Error | null, items: AlphaSenderPage) => any): Promise<AlphaSenderPage>;
/**
* Retrieve a single page of AlphaSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AlphaSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AlphaSenderPage>) => any): Promise<ApiResponse<AlphaSenderPage>>;
pageWithHttpInfo(params: AlphaSenderListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AlphaSenderPage>) => any): Promise<ApiResponse<AlphaSenderPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AlphaSenderListInstance(version: V1, serviceSid: string): AlphaSenderListInstance;
export declare class AlphaSenderPage extends Page<V1, AlphaSenderPayload, AlphaSenderResource, AlphaSenderInstance> {
/**
* Initialize the AlphaSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: AlphaSenderSolution);
/**
* Build an instance of AlphaSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AlphaSenderResource): AlphaSenderInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,367 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlphaSenderPage = exports.AlphaSenderInstance = exports.AlphaSenderContextImpl = void 0;
exports.AlphaSenderListInstance = AlphaSenderListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class AlphaSenderContextImpl {
constructor(_version, serviceSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { serviceSid, sid };
this._uri = `/Services/${serviceSid}/AlphaSenders/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new AlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new AlphaSenderInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AlphaSenderContextImpl = AlphaSenderContextImpl;
class AlphaSenderInstance {
constructor(_version, payload, serviceSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.serviceSid = payload.service_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.alphaSender = payload.alpha_sender;
this.capabilities = payload.capabilities;
this.url = payload.url;
this._solution = { serviceSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new AlphaSenderContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
return this._context;
}
/**
* Remove a AlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a AlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a AlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AlphaSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
serviceSid: this.serviceSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
alphaSender: this.alphaSender,
capabilities: this.capabilities,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AlphaSenderInstance = AlphaSenderInstance;
function AlphaSenderListInstance(version, serviceSid) {
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new AlphaSenderContextImpl(version, serviceSid, sid);
};
instance._version = version;
instance._solution = { serviceSid };
instance._uri = `/Services/${serviceSid}/AlphaSenders`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["alphaSender"] === null || params["alphaSender"] === undefined) {
throw new Error("Required parameter \"params['alphaSender']\" missing.");
}
let data = {};
data["AlphaSender"] = params["alphaSender"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new AlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["alphaSender"] === null || params["alphaSender"] === undefined) {
throw new Error("Required parameter \"params['alphaSender']\" missing.");
}
let data = {};
data["AlphaSender"] = params["alphaSender"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new AlphaSenderInstance(operationVersion, response.body, instance._solution.serviceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new AlphaSenderPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new AlphaSenderPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AlphaSenderPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AlphaSenderPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class AlphaSenderPage extends Page_1.default {
/**
* Initialize the AlphaSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of AlphaSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AlphaSenderInstance(this._version, payload, this._solution.serviceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AlphaSenderPage = AlphaSenderPage;

View File

@@ -0,0 +1,365 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a ChannelSenderInstance
*/
export interface ChannelSenderListInstanceCreateOptions {
/** The SID of the Channel Sender being added to the Service. */
sid: string;
}
/**
* Options to pass to each
*/
export interface ChannelSenderListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ChannelSenderListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ChannelSenderListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ChannelSenderContext {
/**
* Remove a ChannelSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ChannelSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ChannelSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance
*/
fetch(callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>;
/**
* Fetch a ChannelSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelSenderInstance>) => any): Promise<ApiResponse<ChannelSenderInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ChannelSenderContextSolution {
messagingServiceSid: string;
sid: string;
}
export declare class ChannelSenderContextImpl implements ChannelSenderContext {
protected _version: V1;
protected _solution: ChannelSenderContextSolution;
protected _uri: string;
constructor(_version: V1, messagingServiceSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelSenderInstance>) => any): Promise<ApiResponse<ChannelSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ChannelSenderContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ChannelSenderPayload extends TwilioResponsePayload {
senders: ChannelSenderResource[];
}
interface ChannelSenderResource {
account_sid: string;
messaging_service_sid: string;
sid: string;
sender: string;
sender_type: string;
country_code: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class ChannelSenderInstance {
protected _version: V1;
protected _solution: ChannelSenderContextSolution;
protected _context?: ChannelSenderContext;
constructor(_version: V1, payload: ChannelSenderResource, messagingServiceSid: string, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource.
*/
accountSid: string;
/**
* The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with.
*/
messagingServiceSid: string;
/**
* The unique string that we created to identify the ChannelSender resource.
*/
sid: string;
/**
* The unique string that identifies the sender e.g whatsapp:+123456XXXX.
*/
sender: string;
/**
* A string value that identifies the sender type e.g WhatsApp, Messenger.
*/
senderType: string;
/**
* The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
*/
countryCode: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the ChannelSender resource.
*/
url: string;
private get _proxy();
/**
* Remove a ChannelSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ChannelSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ChannelSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance
*/
fetch(callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>;
/**
* Fetch a ChannelSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelSenderInstance>) => any): Promise<ApiResponse<ChannelSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
messagingServiceSid: string;
sid: string;
sender: string;
senderType: string;
countryCode: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ChannelSenderSolution {
messagingServiceSid: string;
}
export interface ChannelSenderListInstance {
_version: V1;
_solution: ChannelSenderSolution;
_uri: string;
(sid: string): ChannelSenderContext;
get(sid: string): ChannelSenderContext;
/**
* Create a ChannelSenderInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance
*/
create(params: ChannelSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>;
/**
* Create a ChannelSenderInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance with HTTP metadata
*/
createWithHttpInfo(params: ChannelSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ChannelSenderInstance>) => any): Promise<ApiResponse<ChannelSenderInstance>>;
/**
* Streams ChannelSenderInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void): void;
each(params: ChannelSenderListInstanceEachOptions, callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ChannelSenderInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ChannelSenderListInstanceEachOptions, callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ChannelSenderInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ChannelSenderPage) => any): Promise<ChannelSenderPage>;
/**
* Retrieve a single target page of ChannelSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ChannelSenderPage>) => any): Promise<ApiResponse<ChannelSenderPage>>;
/**
* Lists ChannelSenderInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ChannelSenderInstance[]) => any): Promise<ChannelSenderInstance[]>;
list(params: ChannelSenderListInstanceOptions, callback?: (error: Error | null, items: ChannelSenderInstance[]) => any): Promise<ChannelSenderInstance[]>;
/**
* Lists ChannelSenderInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ChannelSenderInstance[]>) => any): Promise<ApiResponse<ChannelSenderInstance[]>>;
listWithHttpInfo(params: ChannelSenderListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ChannelSenderInstance[]>) => any): Promise<ApiResponse<ChannelSenderInstance[]>>;
/**
* Retrieve a single page of ChannelSenderInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ChannelSenderPage) => any): Promise<ChannelSenderPage>;
page(params: ChannelSenderListInstancePageOptions, callback?: (error: Error | null, items: ChannelSenderPage) => any): Promise<ChannelSenderPage>;
/**
* Retrieve a single page of ChannelSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ChannelSenderPage>) => any): Promise<ApiResponse<ChannelSenderPage>>;
pageWithHttpInfo(params: ChannelSenderListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ChannelSenderPage>) => any): Promise<ApiResponse<ChannelSenderPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ChannelSenderListInstance(version: V1, messagingServiceSid: string): ChannelSenderListInstance;
export declare class ChannelSenderPage extends Page<V1, ChannelSenderPayload, ChannelSenderResource, ChannelSenderInstance> {
/**
* Initialize the ChannelSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ChannelSenderSolution);
/**
* Build an instance of ChannelSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ChannelSenderResource): ChannelSenderInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,369 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelSenderPage = exports.ChannelSenderInstance = exports.ChannelSenderContextImpl = void 0;
exports.ChannelSenderListInstance = ChannelSenderListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class ChannelSenderContextImpl {
constructor(_version, messagingServiceSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { messagingServiceSid, sid };
this._uri = `/Services/${messagingServiceSid}/ChannelSenders/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelSenderInstance(operationVersion, payload, instance._solution.messagingServiceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ChannelSenderInstance(operationVersion, response.body, instance._solution.messagingServiceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChannelSenderContextImpl = ChannelSenderContextImpl;
class ChannelSenderInstance {
constructor(_version, payload, messagingServiceSid, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.messagingServiceSid = payload.messaging_service_sid;
this.sid = payload.sid;
this.sender = payload.sender;
this.senderType = payload.sender_type;
this.countryCode = payload.country_code;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { messagingServiceSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ChannelSenderContextImpl(this._version, this._solution.messagingServiceSid, this._solution.sid);
return this._context;
}
/**
* Remove a ChannelSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ChannelSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a ChannelSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ChannelSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
messagingServiceSid: this.messagingServiceSid,
sid: this.sid,
sender: this.sender,
senderType: this.senderType,
countryCode: this.countryCode,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChannelSenderInstance = ChannelSenderInstance;
function ChannelSenderListInstance(version, messagingServiceSid) {
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ChannelSenderContextImpl(version, messagingServiceSid, sid);
};
instance._version = version;
instance._solution = { messagingServiceSid };
instance._uri = `/Services/${messagingServiceSid}/ChannelSenders`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["sid"] === null || params["sid"] === undefined) {
throw new Error("Required parameter \"params['sid']\" missing.");
}
let data = {};
data["Sid"] = params["sid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelSenderInstance(operationVersion, payload, instance._solution.messagingServiceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["sid"] === null || params["sid"] === undefined) {
throw new Error("Required parameter \"params['sid']\" missing.");
}
let data = {};
data["Sid"] = params["sid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ChannelSenderInstance(operationVersion, response.body, instance._solution.messagingServiceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelSenderPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ChannelSenderPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ChannelSenderPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ChannelSenderPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ChannelSenderPage extends Page_1.default {
/**
* Initialize the ChannelSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ChannelSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ChannelSenderInstance(this._version, payload, this._solution.messagingServiceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChannelSenderPage = ChannelSenderPage;

View File

@@ -0,0 +1,373 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a DestinationAlphaSenderInstance
*/
export interface DestinationAlphaSenderListInstanceCreateOptions {
/** The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. */
alphaSender: string;
/** The Optional Two Character ISO Country Code the Alphanumeric Sender ID will be used for. If the IsoCountryCode is not provided, a default Alpha Sender will be created that can be used across all countries. */
isoCountryCode?: string;
}
/**
* Options to pass to each
*/
export interface DestinationAlphaSenderListInstanceEachOptions {
/** Optional filter to return only alphanumeric sender IDs associated with the specified two-character ISO country code. */
isoCountryCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface DestinationAlphaSenderListInstanceOptions {
/** Optional filter to return only alphanumeric sender IDs associated with the specified two-character ISO country code. */
isoCountryCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface DestinationAlphaSenderListInstancePageOptions {
/** Optional filter to return only alphanumeric sender IDs associated with the specified two-character ISO country code. */
isoCountryCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface DestinationAlphaSenderContext {
/**
* Remove a DestinationAlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a DestinationAlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a DestinationAlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance
*/
fetch(callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
/**
* Fetch a DestinationAlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DestinationAlphaSenderInstance>) => any): Promise<ApiResponse<DestinationAlphaSenderInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DestinationAlphaSenderContextSolution {
serviceSid: string;
sid: string;
}
export declare class DestinationAlphaSenderContextImpl implements DestinationAlphaSenderContext {
protected _version: V1;
protected _solution: DestinationAlphaSenderContextSolution;
protected _uri: string;
constructor(_version: V1, serviceSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DestinationAlphaSenderInstance>) => any): Promise<ApiResponse<DestinationAlphaSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DestinationAlphaSenderContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DestinationAlphaSenderPayload extends TwilioResponsePayload {
alpha_senders: DestinationAlphaSenderResource[];
}
interface DestinationAlphaSenderResource {
sid: string;
account_sid: string;
service_sid: string;
date_created: Date;
date_updated: Date;
alpha_sender: string;
capabilities: Array<string>;
url: string;
iso_country_code: string;
}
export declare class DestinationAlphaSenderInstance {
protected _version: V1;
protected _solution: DestinationAlphaSenderContextSolution;
protected _context?: DestinationAlphaSenderContext;
constructor(_version: V1, payload: DestinationAlphaSenderResource, serviceSid: string, sid?: string);
/**
* The unique string that we created to identify the AlphaSender resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource.
*/
accountSid: string;
/**
* The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
*/
serviceSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The Alphanumeric Sender ID string.
*/
alphaSender: string;
/**
* An array of values that describe whether the number can receive calls or messages. Can be: `SMS`.
*/
capabilities: Array<string>;
/**
* The absolute URL of the AlphaSender resource.
*/
url: string;
/**
* The Two Character ISO Country Code the Alphanumeric Sender ID will be used for. For Default Alpha Senders that work across countries, this value will be an empty string
*/
isoCountryCode: string;
private get _proxy();
/**
* Remove a DestinationAlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a DestinationAlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a DestinationAlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance
*/
fetch(callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
/**
* Fetch a DestinationAlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DestinationAlphaSenderInstance>) => any): Promise<ApiResponse<DestinationAlphaSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
serviceSid: string;
dateCreated: Date;
dateUpdated: Date;
alphaSender: string;
capabilities: string[];
url: string;
isoCountryCode: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DestinationAlphaSenderSolution {
serviceSid: string;
}
export interface DestinationAlphaSenderListInstance {
_version: V1;
_solution: DestinationAlphaSenderSolution;
_uri: string;
(sid: string): DestinationAlphaSenderContext;
get(sid: string): DestinationAlphaSenderContext;
/**
* Create a DestinationAlphaSenderInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance
*/
create(params: DestinationAlphaSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
/**
* Create a DestinationAlphaSenderInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance with HTTP metadata
*/
createWithHttpInfo(params: DestinationAlphaSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<DestinationAlphaSenderInstance>) => any): Promise<ApiResponse<DestinationAlphaSenderInstance>>;
/**
* Streams DestinationAlphaSenderInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DestinationAlphaSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void): void;
each(params: DestinationAlphaSenderListInstanceEachOptions, callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Streams DestinationAlphaSenderInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DestinationAlphaSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: DestinationAlphaSenderListInstanceEachOptions, callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of DestinationAlphaSenderInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: DestinationAlphaSenderPage) => any): Promise<DestinationAlphaSenderPage>;
/**
* Retrieve a single target page of DestinationAlphaSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<DestinationAlphaSenderPage>) => any): Promise<ApiResponse<DestinationAlphaSenderPage>>;
/**
* Lists DestinationAlphaSenderInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DestinationAlphaSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: DestinationAlphaSenderInstance[]) => any): Promise<DestinationAlphaSenderInstance[]>;
list(params: DestinationAlphaSenderListInstanceOptions, callback?: (error: Error | null, items: DestinationAlphaSenderInstance[]) => any): Promise<DestinationAlphaSenderInstance[]>;
/**
* Lists DestinationAlphaSenderInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DestinationAlphaSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DestinationAlphaSenderInstance[]>) => any): Promise<ApiResponse<DestinationAlphaSenderInstance[]>>;
listWithHttpInfo(params: DestinationAlphaSenderListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<DestinationAlphaSenderInstance[]>) => any): Promise<ApiResponse<DestinationAlphaSenderInstance[]>>;
/**
* Retrieve a single page of DestinationAlphaSenderInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DestinationAlphaSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: DestinationAlphaSenderPage) => any): Promise<DestinationAlphaSenderPage>;
page(params: DestinationAlphaSenderListInstancePageOptions, callback?: (error: Error | null, items: DestinationAlphaSenderPage) => any): Promise<DestinationAlphaSenderPage>;
/**
* Retrieve a single page of DestinationAlphaSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DestinationAlphaSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DestinationAlphaSenderPage>) => any): Promise<ApiResponse<DestinationAlphaSenderPage>>;
pageWithHttpInfo(params: DestinationAlphaSenderListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<DestinationAlphaSenderPage>) => any): Promise<ApiResponse<DestinationAlphaSenderPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DestinationAlphaSenderListInstance(version: V1, serviceSid: string): DestinationAlphaSenderListInstance;
export declare class DestinationAlphaSenderPage extends Page<V1, DestinationAlphaSenderPayload, DestinationAlphaSenderResource, DestinationAlphaSenderInstance> {
/**
* Initialize the DestinationAlphaSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: DestinationAlphaSenderSolution);
/**
* Build an instance of DestinationAlphaSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: DestinationAlphaSenderResource): DestinationAlphaSenderInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,377 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DestinationAlphaSenderPage = exports.DestinationAlphaSenderInstance = exports.DestinationAlphaSenderContextImpl = void 0;
exports.DestinationAlphaSenderListInstance = DestinationAlphaSenderListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class DestinationAlphaSenderContextImpl {
constructor(_version, serviceSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { serviceSid, sid };
this._uri = `/Services/${serviceSid}/DestinationAlphaSenders/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new DestinationAlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new DestinationAlphaSenderInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DestinationAlphaSenderContextImpl = DestinationAlphaSenderContextImpl;
class DestinationAlphaSenderInstance {
constructor(_version, payload, serviceSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.serviceSid = payload.service_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.alphaSender = payload.alpha_sender;
this.capabilities = payload.capabilities;
this.url = payload.url;
this.isoCountryCode = payload.iso_country_code;
this._solution = { serviceSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new DestinationAlphaSenderContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
return this._context;
}
/**
* Remove a DestinationAlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a DestinationAlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a DestinationAlphaSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a DestinationAlphaSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DestinationAlphaSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
serviceSid: this.serviceSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
alphaSender: this.alphaSender,
capabilities: this.capabilities,
url: this.url,
isoCountryCode: this.isoCountryCode,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DestinationAlphaSenderInstance = DestinationAlphaSenderInstance;
function DestinationAlphaSenderListInstance(version, serviceSid) {
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new DestinationAlphaSenderContextImpl(version, serviceSid, sid);
};
instance._version = version;
instance._solution = { serviceSid };
instance._uri = `/Services/${serviceSid}/DestinationAlphaSenders`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["alphaSender"] === null || params["alphaSender"] === undefined) {
throw new Error("Required parameter \"params['alphaSender']\" missing.");
}
let data = {};
data["AlphaSender"] = params["alphaSender"];
if (params["isoCountryCode"] !== undefined)
data["IsoCountryCode"] = params["isoCountryCode"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new DestinationAlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["alphaSender"] === null || params["alphaSender"] === undefined) {
throw new Error("Required parameter \"params['alphaSender']\" missing.");
}
let data = {};
data["AlphaSender"] = params["alphaSender"];
if (params["isoCountryCode"] !== undefined)
data["IsoCountryCode"] = params["isoCountryCode"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new DestinationAlphaSenderInstance(operationVersion, response.body, instance._solution.serviceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["isoCountryCode"] !== undefined)
data["IsoCountryCode"] = params["isoCountryCode"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new DestinationAlphaSenderPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new DestinationAlphaSenderPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["isoCountryCode"] !== undefined)
data["IsoCountryCode"] = params["isoCountryCode"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new DestinationAlphaSenderPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new DestinationAlphaSenderPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class DestinationAlphaSenderPage extends Page_1.default {
/**
* Initialize the DestinationAlphaSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of DestinationAlphaSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new DestinationAlphaSenderInstance(this._version, payload, this._solution.serviceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DestinationAlphaSenderPage = DestinationAlphaSenderPage;

View File

@@ -0,0 +1,365 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a PhoneNumberInstance
*/
export interface PhoneNumberListInstanceCreateOptions {
/** The SID of the Phone Number being added to the Service. */
phoneNumberSid: string;
}
/**
* Options to pass to each
*/
export interface PhoneNumberListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface PhoneNumberListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface PhoneNumberListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface PhoneNumberContext {
/**
* Remove a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PhoneNumberContextSolution {
serviceSid: string;
sid: string;
}
export declare class PhoneNumberContextImpl implements PhoneNumberContext {
protected _version: V1;
protected _solution: PhoneNumberContextSolution;
protected _uri: string;
constructor(_version: V1, serviceSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PhoneNumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PhoneNumberPayload extends TwilioResponsePayload {
phone_numbers: PhoneNumberResource[];
}
interface PhoneNumberResource {
sid: string;
account_sid: string;
service_sid: string;
date_created: Date;
date_updated: Date;
phone_number: string;
country_code: string;
capabilities: Array<string>;
url: string;
}
export declare class PhoneNumberInstance {
protected _version: V1;
protected _solution: PhoneNumberContextSolution;
protected _context?: PhoneNumberContext;
constructor(_version: V1, payload: PhoneNumberResource, serviceSid: string, sid?: string);
/**
* The unique string that we created to identify the PhoneNumber resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource.
*/
accountSid: string;
/**
* The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
*/
serviceSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
*/
phoneNumber: string;
/**
* The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
*/
countryCode: string;
/**
* An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`.
*/
capabilities: Array<string>;
/**
* The absolute URL of the PhoneNumber resource.
*/
url: string;
private get _proxy();
/**
* Remove a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
serviceSid: string;
dateCreated: Date;
dateUpdated: Date;
phoneNumber: string;
countryCode: string;
capabilities: string[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PhoneNumberSolution {
serviceSid: string;
}
export interface PhoneNumberListInstance {
_version: V1;
_solution: PhoneNumberSolution;
_uri: string;
(sid: string): PhoneNumberContext;
get(sid: string): PhoneNumberContext;
/**
* Create a PhoneNumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
create(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Create a PhoneNumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
createWithHttpInfo(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Streams PhoneNumberInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { PhoneNumberListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
each(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
/**
* Streams PhoneNumberInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { PhoneNumberListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of PhoneNumberInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>;
/**
* Retrieve a single target page of PhoneNumberInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<PhoneNumberPage>) => any): Promise<ApiResponse<PhoneNumberPage>>;
/**
* Lists PhoneNumberInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { PhoneNumberListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>;
list(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>;
/**
* Lists PhoneNumberInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { PhoneNumberListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PhoneNumberInstance[]>) => any): Promise<ApiResponse<PhoneNumberInstance[]>>;
listWithHttpInfo(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<PhoneNumberInstance[]>) => any): Promise<ApiResponse<PhoneNumberInstance[]>>;
/**
* Retrieve a single page of PhoneNumberInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { PhoneNumberListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>;
page(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>;
/**
* Retrieve a single page of PhoneNumberInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { PhoneNumberListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PhoneNumberPage>) => any): Promise<ApiResponse<PhoneNumberPage>>;
pageWithHttpInfo(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<PhoneNumberPage>) => any): Promise<ApiResponse<PhoneNumberPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PhoneNumberListInstance(version: V1, serviceSid: string): PhoneNumberListInstance;
export declare class PhoneNumberPage extends Page<V1, PhoneNumberPayload, PhoneNumberResource, PhoneNumberInstance> {
/**
* Initialize the PhoneNumberPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: PhoneNumberSolution);
/**
* Build an instance of PhoneNumberInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: PhoneNumberResource): PhoneNumberInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,371 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PhoneNumberPage = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0;
exports.PhoneNumberListInstance = PhoneNumberListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class PhoneNumberContextImpl {
constructor(_version, serviceSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { serviceSid, sid };
this._uri = `/Services/${serviceSid}/PhoneNumbers/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new PhoneNumberInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberContextImpl = PhoneNumberContextImpl;
class PhoneNumberInstance {
constructor(_version, payload, serviceSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.serviceSid = payload.service_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.phoneNumber = payload.phone_number;
this.countryCode = payload.country_code;
this.capabilities = payload.capabilities;
this.url = payload.url;
this._solution = { serviceSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new PhoneNumberContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
return this._context;
}
/**
* Remove a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
serviceSid: this.serviceSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
phoneNumber: this.phoneNumber,
countryCode: this.countryCode,
capabilities: this.capabilities,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberInstance = PhoneNumberInstance;
function PhoneNumberListInstance(version, serviceSid) {
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new PhoneNumberContextImpl(version, serviceSid, sid);
};
instance._version = version;
instance._solution = { serviceSid };
instance._uri = `/Services/${serviceSid}/PhoneNumbers`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumberSid"] === null ||
params["phoneNumberSid"] === undefined) {
throw new Error("Required parameter \"params['phoneNumberSid']\" missing.");
}
let data = {};
data["PhoneNumberSid"] = params["phoneNumberSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumberSid"] === null ||
params["phoneNumberSid"] === undefined) {
throw new Error("Required parameter \"params['phoneNumberSid']\" missing.");
}
let data = {};
data["PhoneNumberSid"] = params["phoneNumberSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new PhoneNumberInstance(operationVersion, response.body, instance._solution.serviceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new PhoneNumberPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new PhoneNumberPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new PhoneNumberPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new PhoneNumberPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class PhoneNumberPage extends Page_1.default {
/**
* Initialize the PhoneNumberPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of PhoneNumberInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new PhoneNumberInstance(this._version, payload, this._solution.serviceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberPage = PhoneNumberPage;

View File

@@ -0,0 +1,365 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a ShortCodeInstance
*/
export interface ShortCodeListInstanceCreateOptions {
/** The SID of the ShortCode resource being added to the Service. */
shortCodeSid: string;
}
/**
* Options to pass to each
*/
export interface ShortCodeListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ShortCodeListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ShortCodeListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ShortCodeContext {
/**
* Remove a ShortCodeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ShortCodeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ShortCodeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance
*/
fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>;
/**
* Fetch a ShortCodeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ShortCodeInstance>) => any): Promise<ApiResponse<ShortCodeInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ShortCodeContextSolution {
serviceSid: string;
sid: string;
}
export declare class ShortCodeContextImpl implements ShortCodeContext {
protected _version: V1;
protected _solution: ShortCodeContextSolution;
protected _uri: string;
constructor(_version: V1, serviceSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ShortCodeInstance>) => any): Promise<ApiResponse<ShortCodeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ShortCodeContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ShortCodePayload extends TwilioResponsePayload {
short_codes: ShortCodeResource[];
}
interface ShortCodeResource {
sid: string;
account_sid: string;
service_sid: string;
date_created: Date;
date_updated: Date;
short_code: string;
country_code: string;
capabilities: Array<string>;
url: string;
}
export declare class ShortCodeInstance {
protected _version: V1;
protected _solution: ShortCodeContextSolution;
protected _context?: ShortCodeContext;
constructor(_version: V1, payload: ShortCodeResource, serviceSid: string, sid?: string);
/**
* The unique string that we created to identify the ShortCode resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource.
*/
accountSid: string;
/**
* The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
*/
serviceSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code.
*/
shortCode: string;
/**
* The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
*/
countryCode: string;
/**
* An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`.
*/
capabilities: Array<string>;
/**
* The absolute URL of the ShortCode resource.
*/
url: string;
private get _proxy();
/**
* Remove a ShortCodeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ShortCodeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ShortCodeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance
*/
fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>;
/**
* Fetch a ShortCodeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ShortCodeInstance>) => any): Promise<ApiResponse<ShortCodeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
serviceSid: string;
dateCreated: Date;
dateUpdated: Date;
shortCode: string;
countryCode: string;
capabilities: string[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ShortCodeSolution {
serviceSid: string;
}
export interface ShortCodeListInstance {
_version: V1;
_solution: ShortCodeSolution;
_uri: string;
(sid: string): ShortCodeContext;
get(sid: string): ShortCodeContext;
/**
* Create a ShortCodeInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance
*/
create(params: ShortCodeListInstanceCreateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>;
/**
* Create a ShortCodeInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance with HTTP metadata
*/
createWithHttpInfo(params: ShortCodeListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ShortCodeInstance>) => any): Promise<ApiResponse<ShortCodeInstance>>;
/**
* Streams ShortCodeInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ShortCodeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void;
each(params: ShortCodeListInstanceEachOptions, callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ShortCodeInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ShortCodeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ShortCodeListInstanceEachOptions, callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ShortCodeInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>;
/**
* Retrieve a single target page of ShortCodeInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ShortCodePage>) => any): Promise<ApiResponse<ShortCodePage>>;
/**
* Lists ShortCodeInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ShortCodeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>;
list(params: ShortCodeListInstanceOptions, callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>;
/**
* Lists ShortCodeInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ShortCodeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ShortCodeInstance[]>) => any): Promise<ApiResponse<ShortCodeInstance[]>>;
listWithHttpInfo(params: ShortCodeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ShortCodeInstance[]>) => any): Promise<ApiResponse<ShortCodeInstance[]>>;
/**
* Retrieve a single page of ShortCodeInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ShortCodeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>;
page(params: ShortCodeListInstancePageOptions, callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>;
/**
* Retrieve a single page of ShortCodeInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ShortCodeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ShortCodePage>) => any): Promise<ApiResponse<ShortCodePage>>;
pageWithHttpInfo(params: ShortCodeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ShortCodePage>) => any): Promise<ApiResponse<ShortCodePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ShortCodeListInstance(version: V1, serviceSid: string): ShortCodeListInstance;
export declare class ShortCodePage extends Page<V1, ShortCodePayload, ShortCodeResource, ShortCodeInstance> {
/**
* Initialize the ShortCodePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ShortCodeSolution);
/**
* Build an instance of ShortCodeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ShortCodeResource): ShortCodeInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,371 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShortCodePage = exports.ShortCodeInstance = exports.ShortCodeContextImpl = void 0;
exports.ShortCodeListInstance = ShortCodeListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class ShortCodeContextImpl {
constructor(_version, serviceSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { serviceSid, sid };
this._uri = `/Services/${serviceSid}/ShortCodes/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ShortCodeInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ShortCodeContextImpl = ShortCodeContextImpl;
class ShortCodeInstance {
constructor(_version, payload, serviceSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.serviceSid = payload.service_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.shortCode = payload.short_code;
this.countryCode = payload.country_code;
this.capabilities = payload.capabilities;
this.url = payload.url;
this._solution = { serviceSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ShortCodeContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
return this._context;
}
/**
* Remove a ShortCodeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ShortCodeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a ShortCodeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ShortCodeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ShortCodeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
serviceSid: this.serviceSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
shortCode: this.shortCode,
countryCode: this.countryCode,
capabilities: this.capabilities,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ShortCodeInstance = ShortCodeInstance;
function ShortCodeListInstance(version, serviceSid) {
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ShortCodeContextImpl(version, serviceSid, sid);
};
instance._version = version;
instance._solution = { serviceSid };
instance._uri = `/Services/${serviceSid}/ShortCodes`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["shortCodeSid"] === null ||
params["shortCodeSid"] === undefined) {
throw new Error("Required parameter \"params['shortCodeSid']\" missing.");
}
let data = {};
data["ShortCodeSid"] = params["shortCodeSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["shortCodeSid"] === null ||
params["shortCodeSid"] === undefined) {
throw new Error("Required parameter \"params['shortCodeSid']\" missing.");
}
let data = {};
data["ShortCodeSid"] = params["shortCodeSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ShortCodeInstance(operationVersion, response.body, instance._solution.serviceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ShortCodePage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ShortCodePage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ShortCodePage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ShortCodePage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ShortCodePage extends Page_1.default {
/**
* Initialize the ShortCodePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ShortCodeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ShortCodeInstance(this._version, payload, this._solution.serviceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ShortCodePage = ShortCodePage;

View File

@@ -0,0 +1,639 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to fetch a UsAppToPersonInstance
*/
export interface UsAppToPersonContextFetchOptions {
/** The version of the Messaging API to use for this request */
xTwilioApiVersion?: string;
}
/**
* Options to pass to update a UsAppToPersonInstance
*/
export interface UsAppToPersonContextUpdateOptions {
/** Indicates that this SMS campaign will send messages that contain links. */
hasEmbeddedLinks: boolean;
/** Indicates that this SMS campaign will send messages that contain phone numbers. */
hasEmbeddedPhone: boolean;
/** An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. */
messageSamples: Array<string>;
/** Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. */
messageFlow: string;
/** A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. */
description: string;
/** A boolean that specifies whether campaign requires age gate for federally legal content. */
ageGated: boolean;
/** A boolean that specifies whether campaign allows direct lending or not. */
directLending: boolean;
/** The version of the Messaging API to use for this request */
xTwilioApiVersion?: string;
/** The URL of the privacy policy for the campaign. */
privacyPolicyUrl?: string;
/** The URL of the terms and conditions for the campaign. */
termsAndConditionsUrl?: string;
}
/**
* Options to pass to create a UsAppToPersonInstance
*/
export interface UsAppToPersonListInstanceCreateOptions {
/** A2P Brand Registration SID */
brandRegistrationSid: string;
/** A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. */
description: string;
/** Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. */
messageFlow: string;
/** An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. */
messageSamples: Array<string>;
/** A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] */
usAppToPersonUsecase: string;
/** Indicates that this SMS campaign will send messages that contain links. */
hasEmbeddedLinks: boolean;
/** Indicates that this SMS campaign will send messages that contain phone numbers. */
hasEmbeddedPhone: boolean;
/** The version of the Messaging API to use for this request */
xTwilioApiVersion?: string;
/** If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. */
optInMessage?: string;
/** Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. */
optOutMessage?: string;
/** When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. */
helpMessage?: string;
/** If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. */
optInKeywords?: Array<string>;
/** End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. */
optOutKeywords?: Array<string>;
/** End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. */
helpKeywords?: Array<string>;
/** A boolean that specifies whether campaign has Subscriber Optin or not. */
subscriberOptIn?: boolean;
/** A boolean that specifies whether campaign is age gated or not. */
ageGated?: boolean;
/** A boolean that specifies whether campaign allows direct lending or not. */
directLending?: boolean;
/** The URL of the privacy policy for the campaign. */
privacyPolicyUrl?: string;
/** The URL of the terms and conditions for the campaign. */
termsAndConditionsUrl?: string;
}
/**
* Options to pass to each
*/
export interface UsAppToPersonListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The version of the Messaging API to use for this request */
xTwilioApiVersion?: string;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface UsAppToPersonListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The version of the Messaging API to use for this request */
xTwilioApiVersion?: string;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface UsAppToPersonListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The version of the Messaging API to use for this request */
xTwilioApiVersion?: string;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface UsAppToPersonContext {
/**
* Remove a UsAppToPersonInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a UsAppToPersonInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a UsAppToPersonInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
fetch(callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Fetch a UsAppToPersonInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
fetch(params: UsAppToPersonContextFetchOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Fetch a UsAppToPersonInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Fetch a UsAppToPersonInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
fetchWithHttpInfo(params: UsAppToPersonContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Update a UsAppToPersonInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
update(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Update a UsAppToPersonInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
updateWithHttpInfo(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface UsAppToPersonContextSolution {
messagingServiceSid: string;
sid: string;
}
export declare class UsAppToPersonContextImpl implements UsAppToPersonContext {
protected _version: V1;
protected _solution: UsAppToPersonContextSolution;
protected _uri: string;
constructor(_version: V1, messagingServiceSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(params?: UsAppToPersonContextFetchOptions | ((error: Error | null, item?: UsAppToPersonInstance) => any), callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
fetchWithHttpInfo(params?: UsAppToPersonContextFetchOptions | ((error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
update(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
updateWithHttpInfo(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): UsAppToPersonContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface UsAppToPersonPayload extends TwilioResponsePayload {
compliance: UsAppToPersonResource[];
}
interface UsAppToPersonResource {
sid: string;
account_sid: string;
brand_registration_sid: string;
messaging_service_sid: string;
description: string;
message_samples: Array<string>;
us_app_to_person_usecase: string;
has_embedded_links: boolean;
has_embedded_phone: boolean;
subscriber_opt_in: boolean;
age_gated: boolean;
direct_lending: boolean;
campaign_status: string;
campaign_id: string;
is_externally_registered: boolean;
rate_limits: any;
message_flow: string;
opt_in_message: string;
opt_out_message: string;
help_message: string;
opt_in_keywords: Array<string>;
opt_out_keywords: Array<string>;
help_keywords: Array<string>;
date_created: Date;
date_updated: Date;
url: string;
mock: boolean;
errors: Array<Record<string, object>>;
privacy_policy_url: string;
terms_and_conditions_url: string;
}
export declare class UsAppToPersonInstance {
protected _version: V1;
protected _solution: UsAppToPersonContextSolution;
protected _context?: UsAppToPersonContext;
constructor(_version: V1, payload: UsAppToPersonResource, messagingServiceSid: string, sid?: string);
/**
* The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to.
*/
accountSid: string;
/**
* The unique string to identify the A2P brand.
*/
brandRegistrationSid: string;
/**
* The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.
*/
messagingServiceSid: string;
/**
* A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.
*/
description: string;
/**
* An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.
*/
messageSamples: Array<string>;
/**
* A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand.
*/
usAppToPersonUsecase: string;
/**
* Indicate that this SMS campaign will send messages that contain links.
*/
hasEmbeddedLinks: boolean;
/**
* Indicates that this SMS campaign will send messages that contain phone numbers.
*/
hasEmbeddedPhone: boolean;
/**
* A boolean that specifies whether campaign has Subscriber Optin or not.
*/
subscriberOptIn: boolean;
/**
* A boolean that specifies whether campaign is age gated or not.
*/
ageGated: boolean;
/**
* A boolean that specifies whether campaign allows direct lending or not.
*/
directLending: boolean;
/**
* Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED.
*/
campaignStatus: string;
/**
* The Campaign Registry (TCR) Campaign ID.
*/
campaignId: string;
/**
* Indicates whether the campaign was registered externally or not.
*/
isExternallyRegistered: boolean;
/**
* Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile.
*/
rateLimits: any;
/**
* Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.
*/
messageFlow: string;
/**
* If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.
*/
optInMessage: string;
/**
* Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
*/
optOutMessage: string;
/**
* When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
*/
helpMessage: string;
/**
* If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.
*/
optInKeywords: Array<string>;
/**
* End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
*/
optOutKeywords: Array<string>;
/**
* End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
*/
helpKeywords: Array<string>;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the US App to Person resource.
*/
url: string;
/**
* A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes.
*/
mock: boolean;
/**
* Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements.
*/
errors: Array<Record<string, object>>;
/**
* The URL of the privacy policy for the campaign.
*/
privacyPolicyUrl: string;
/**
* The URL of the terms and conditions for the campaign.
*/
termsAndConditionsUrl: string;
private get _proxy();
/**
* Remove a UsAppToPersonInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a UsAppToPersonInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a UsAppToPersonInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
fetch(callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Fetch a UsAppToPersonInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
fetch(params: UsAppToPersonContextFetchOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Fetch a UsAppToPersonInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Fetch a UsAppToPersonInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
fetchWithHttpInfo(params: UsAppToPersonContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Update a UsAppToPersonInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
update(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Update a UsAppToPersonInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
updateWithHttpInfo(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
brandRegistrationSid: string;
messagingServiceSid: string;
description: string;
messageSamples: string[];
usAppToPersonUsecase: string;
hasEmbeddedLinks: boolean;
hasEmbeddedPhone: boolean;
subscriberOptIn: boolean;
ageGated: boolean;
directLending: boolean;
campaignStatus: string;
campaignId: string;
isExternallyRegistered: boolean;
rateLimits: any;
messageFlow: string;
optInMessage: string;
optOutMessage: string;
helpMessage: string;
optInKeywords: string[];
optOutKeywords: string[];
helpKeywords: string[];
dateCreated: Date;
dateUpdated: Date;
url: string;
mock: boolean;
errors: Record<string, object>[];
privacyPolicyUrl: string;
termsAndConditionsUrl: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface UsAppToPersonSolution {
messagingServiceSid: string;
}
export interface UsAppToPersonListInstance {
_version: V1;
_solution: UsAppToPersonSolution;
_uri: string;
(sid: string): UsAppToPersonContext;
get(sid: string): UsAppToPersonContext;
/**
* Create a UsAppToPersonInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance
*/
create(params: UsAppToPersonListInstanceCreateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>;
/**
* Create a UsAppToPersonInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonInstance with HTTP metadata
*/
createWithHttpInfo(params: UsAppToPersonListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonInstance>) => any): Promise<ApiResponse<UsAppToPersonInstance>>;
/**
* Streams UsAppToPersonInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { UsAppToPersonListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void): void;
each(params: UsAppToPersonListInstanceEachOptions, callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void): void;
/**
* Streams UsAppToPersonInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { UsAppToPersonListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: UsAppToPersonListInstanceEachOptions, callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of UsAppToPersonInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: UsAppToPersonPage) => any): Promise<UsAppToPersonPage>;
/**
* Retrieve a single target page of UsAppToPersonInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<UsAppToPersonPage>) => any): Promise<ApiResponse<UsAppToPersonPage>>;
/**
* Lists UsAppToPersonInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { UsAppToPersonListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: UsAppToPersonInstance[]) => any): Promise<UsAppToPersonInstance[]>;
list(params: UsAppToPersonListInstanceOptions, callback?: (error: Error | null, items: UsAppToPersonInstance[]) => any): Promise<UsAppToPersonInstance[]>;
/**
* Lists UsAppToPersonInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { UsAppToPersonListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<UsAppToPersonInstance[]>) => any): Promise<ApiResponse<UsAppToPersonInstance[]>>;
listWithHttpInfo(params: UsAppToPersonListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<UsAppToPersonInstance[]>) => any): Promise<ApiResponse<UsAppToPersonInstance[]>>;
/**
* Retrieve a single page of UsAppToPersonInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { UsAppToPersonListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: UsAppToPersonPage) => any): Promise<UsAppToPersonPage>;
page(params: UsAppToPersonListInstancePageOptions, callback?: (error: Error | null, items: UsAppToPersonPage) => any): Promise<UsAppToPersonPage>;
/**
* Retrieve a single page of UsAppToPersonInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { UsAppToPersonListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<UsAppToPersonPage>) => any): Promise<ApiResponse<UsAppToPersonPage>>;
pageWithHttpInfo(params: UsAppToPersonListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<UsAppToPersonPage>) => any): Promise<ApiResponse<UsAppToPersonPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function UsAppToPersonListInstance(version: V1, messagingServiceSid: string): UsAppToPersonListInstance;
export declare class UsAppToPersonPage extends Page<V1, UsAppToPersonPayload, UsAppToPersonResource, UsAppToPersonInstance> {
/**
* Initialize the UsAppToPersonPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: UsAppToPersonSolution);
/**
* Build an instance of UsAppToPersonInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: UsAppToPersonResource): UsAppToPersonInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,655 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsAppToPersonPage = exports.UsAppToPersonInstance = exports.UsAppToPersonContextImpl = void 0;
exports.UsAppToPersonListInstance = UsAppToPersonListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class UsAppToPersonContextImpl {
constructor(_version, messagingServiceSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { messagingServiceSid, sid };
this._uri = `/Services/${messagingServiceSid}/Compliance/Usa2p/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
const headers = {};
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new UsAppToPersonInstance(operationVersion, payload, instance._solution.messagingServiceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
const headers = {};
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new UsAppToPersonInstance(operationVersion, response.body, instance._solution.messagingServiceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["hasEmbeddedLinks"] === null ||
params["hasEmbeddedLinks"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedLinks']\" missing.");
}
if (params["hasEmbeddedPhone"] === null ||
params["hasEmbeddedPhone"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedPhone']\" missing.");
}
if (params["messageSamples"] === null ||
params["messageSamples"] === undefined) {
throw new Error("Required parameter \"params['messageSamples']\" missing.");
}
if (params["messageFlow"] === null || params["messageFlow"] === undefined) {
throw new Error("Required parameter \"params['messageFlow']\" missing.");
}
if (params["description"] === null || params["description"] === undefined) {
throw new Error("Required parameter \"params['description']\" missing.");
}
if (params["ageGated"] === null || params["ageGated"] === undefined) {
throw new Error("Required parameter \"params['ageGated']\" missing.");
}
if (params["directLending"] === null ||
params["directLending"] === undefined) {
throw new Error("Required parameter \"params['directLending']\" missing.");
}
let data = {};
data["HasEmbeddedLinks"] = serialize.bool(params["hasEmbeddedLinks"]);
data["HasEmbeddedPhone"] = serialize.bool(params["hasEmbeddedPhone"]);
data["MessageSamples"] = serialize.map(params["messageSamples"], (e) => e);
data["MessageFlow"] = params["messageFlow"];
data["Description"] = params["description"];
data["AgeGated"] = serialize.bool(params["ageGated"]);
data["DirectLending"] = serialize.bool(params["directLending"]);
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new UsAppToPersonInstance(operationVersion, payload, instance._solution.messagingServiceSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["hasEmbeddedLinks"] === null ||
params["hasEmbeddedLinks"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedLinks']\" missing.");
}
if (params["hasEmbeddedPhone"] === null ||
params["hasEmbeddedPhone"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedPhone']\" missing.");
}
if (params["messageSamples"] === null ||
params["messageSamples"] === undefined) {
throw new Error("Required parameter \"params['messageSamples']\" missing.");
}
if (params["messageFlow"] === null || params["messageFlow"] === undefined) {
throw new Error("Required parameter \"params['messageFlow']\" missing.");
}
if (params["description"] === null || params["description"] === undefined) {
throw new Error("Required parameter \"params['description']\" missing.");
}
if (params["ageGated"] === null || params["ageGated"] === undefined) {
throw new Error("Required parameter \"params['ageGated']\" missing.");
}
if (params["directLending"] === null ||
params["directLending"] === undefined) {
throw new Error("Required parameter \"params['directLending']\" missing.");
}
let data = {};
data["HasEmbeddedLinks"] = serialize.bool(params["hasEmbeddedLinks"]);
data["HasEmbeddedPhone"] = serialize.bool(params["hasEmbeddedPhone"]);
data["MessageSamples"] = serialize.map(params["messageSamples"], (e) => e);
data["MessageFlow"] = params["messageFlow"];
data["Description"] = params["description"];
data["AgeGated"] = serialize.bool(params["ageGated"]);
data["DirectLending"] = serialize.bool(params["directLending"]);
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new UsAppToPersonInstance(operationVersion, response.body, instance._solution.messagingServiceSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsAppToPersonContextImpl = UsAppToPersonContextImpl;
class UsAppToPersonInstance {
constructor(_version, payload, messagingServiceSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.brandRegistrationSid = payload.brand_registration_sid;
this.messagingServiceSid = payload.messaging_service_sid;
this.description = payload.description;
this.messageSamples = payload.message_samples;
this.usAppToPersonUsecase = payload.us_app_to_person_usecase;
this.hasEmbeddedLinks = payload.has_embedded_links;
this.hasEmbeddedPhone = payload.has_embedded_phone;
this.subscriberOptIn = payload.subscriber_opt_in;
this.ageGated = payload.age_gated;
this.directLending = payload.direct_lending;
this.campaignStatus = payload.campaign_status;
this.campaignId = payload.campaign_id;
this.isExternallyRegistered = payload.is_externally_registered;
this.rateLimits = payload.rate_limits;
this.messageFlow = payload.message_flow;
this.optInMessage = payload.opt_in_message;
this.optOutMessage = payload.opt_out_message;
this.helpMessage = payload.help_message;
this.optInKeywords = payload.opt_in_keywords;
this.optOutKeywords = payload.opt_out_keywords;
this.helpKeywords = payload.help_keywords;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.mock = payload.mock;
this.errors = payload.errors;
this.privacyPolicyUrl = payload.privacy_policy_url;
this.termsAndConditionsUrl = payload.terms_and_conditions_url;
this._solution = { messagingServiceSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new UsAppToPersonContextImpl(this._version, this._solution.messagingServiceSid, this._solution.sid);
return this._context;
}
/**
* Remove a UsAppToPersonInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a UsAppToPersonInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
brandRegistrationSid: this.brandRegistrationSid,
messagingServiceSid: this.messagingServiceSid,
description: this.description,
messageSamples: this.messageSamples,
usAppToPersonUsecase: this.usAppToPersonUsecase,
hasEmbeddedLinks: this.hasEmbeddedLinks,
hasEmbeddedPhone: this.hasEmbeddedPhone,
subscriberOptIn: this.subscriberOptIn,
ageGated: this.ageGated,
directLending: this.directLending,
campaignStatus: this.campaignStatus,
campaignId: this.campaignId,
isExternallyRegistered: this.isExternallyRegistered,
rateLimits: this.rateLimits,
messageFlow: this.messageFlow,
optInMessage: this.optInMessage,
optOutMessage: this.optOutMessage,
helpMessage: this.helpMessage,
optInKeywords: this.optInKeywords,
optOutKeywords: this.optOutKeywords,
helpKeywords: this.helpKeywords,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
mock: this.mock,
errors: this.errors,
privacyPolicyUrl: this.privacyPolicyUrl,
termsAndConditionsUrl: this.termsAndConditionsUrl,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsAppToPersonInstance = UsAppToPersonInstance;
function UsAppToPersonListInstance(version, messagingServiceSid) {
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new UsAppToPersonContextImpl(version, messagingServiceSid, sid);
};
instance._version = version;
instance._solution = { messagingServiceSid };
instance._uri = `/Services/${messagingServiceSid}/Compliance/Usa2p`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["brandRegistrationSid"] === null ||
params["brandRegistrationSid"] === undefined) {
throw new Error("Required parameter \"params['brandRegistrationSid']\" missing.");
}
if (params["description"] === null || params["description"] === undefined) {
throw new Error("Required parameter \"params['description']\" missing.");
}
if (params["messageFlow"] === null || params["messageFlow"] === undefined) {
throw new Error("Required parameter \"params['messageFlow']\" missing.");
}
if (params["messageSamples"] === null ||
params["messageSamples"] === undefined) {
throw new Error("Required parameter \"params['messageSamples']\" missing.");
}
if (params["usAppToPersonUsecase"] === null ||
params["usAppToPersonUsecase"] === undefined) {
throw new Error("Required parameter \"params['usAppToPersonUsecase']\" missing.");
}
if (params["hasEmbeddedLinks"] === null ||
params["hasEmbeddedLinks"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedLinks']\" missing.");
}
if (params["hasEmbeddedPhone"] === null ||
params["hasEmbeddedPhone"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedPhone']\" missing.");
}
let data = {};
data["BrandRegistrationSid"] = params["brandRegistrationSid"];
data["Description"] = params["description"];
data["MessageFlow"] = params["messageFlow"];
data["MessageSamples"] = serialize.map(params["messageSamples"], (e) => e);
data["UsAppToPersonUsecase"] = params["usAppToPersonUsecase"];
data["HasEmbeddedLinks"] = serialize.bool(params["hasEmbeddedLinks"]);
data["HasEmbeddedPhone"] = serialize.bool(params["hasEmbeddedPhone"]);
if (params["optInMessage"] !== undefined)
data["OptInMessage"] = params["optInMessage"];
if (params["optOutMessage"] !== undefined)
data["OptOutMessage"] = params["optOutMessage"];
if (params["helpMessage"] !== undefined)
data["HelpMessage"] = params["helpMessage"];
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["optOutKeywords"] !== undefined)
data["OptOutKeywords"] = serialize.map(params["optOutKeywords"], (e) => e);
if (params["helpKeywords"] !== undefined)
data["HelpKeywords"] = serialize.map(params["helpKeywords"], (e) => e);
if (params["subscriberOptIn"] !== undefined)
data["SubscriberOptIn"] = serialize.bool(params["subscriberOptIn"]);
if (params["ageGated"] !== undefined)
data["AgeGated"] = serialize.bool(params["ageGated"]);
if (params["directLending"] !== undefined)
data["DirectLending"] = serialize.bool(params["directLending"]);
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new UsAppToPersonInstance(operationVersion, payload, instance._solution.messagingServiceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["brandRegistrationSid"] === null ||
params["brandRegistrationSid"] === undefined) {
throw new Error("Required parameter \"params['brandRegistrationSid']\" missing.");
}
if (params["description"] === null || params["description"] === undefined) {
throw new Error("Required parameter \"params['description']\" missing.");
}
if (params["messageFlow"] === null || params["messageFlow"] === undefined) {
throw new Error("Required parameter \"params['messageFlow']\" missing.");
}
if (params["messageSamples"] === null ||
params["messageSamples"] === undefined) {
throw new Error("Required parameter \"params['messageSamples']\" missing.");
}
if (params["usAppToPersonUsecase"] === null ||
params["usAppToPersonUsecase"] === undefined) {
throw new Error("Required parameter \"params['usAppToPersonUsecase']\" missing.");
}
if (params["hasEmbeddedLinks"] === null ||
params["hasEmbeddedLinks"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedLinks']\" missing.");
}
if (params["hasEmbeddedPhone"] === null ||
params["hasEmbeddedPhone"] === undefined) {
throw new Error("Required parameter \"params['hasEmbeddedPhone']\" missing.");
}
let data = {};
data["BrandRegistrationSid"] = params["brandRegistrationSid"];
data["Description"] = params["description"];
data["MessageFlow"] = params["messageFlow"];
data["MessageSamples"] = serialize.map(params["messageSamples"], (e) => e);
data["UsAppToPersonUsecase"] = params["usAppToPersonUsecase"];
data["HasEmbeddedLinks"] = serialize.bool(params["hasEmbeddedLinks"]);
data["HasEmbeddedPhone"] = serialize.bool(params["hasEmbeddedPhone"]);
if (params["optInMessage"] !== undefined)
data["OptInMessage"] = params["optInMessage"];
if (params["optOutMessage"] !== undefined)
data["OptOutMessage"] = params["optOutMessage"];
if (params["helpMessage"] !== undefined)
data["HelpMessage"] = params["helpMessage"];
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["optOutKeywords"] !== undefined)
data["OptOutKeywords"] = serialize.map(params["optOutKeywords"], (e) => e);
if (params["helpKeywords"] !== undefined)
data["HelpKeywords"] = serialize.map(params["helpKeywords"], (e) => e);
if (params["subscriberOptIn"] !== undefined)
data["SubscriberOptIn"] = serialize.bool(params["subscriberOptIn"]);
if (params["ageGated"] !== undefined)
data["AgeGated"] = serialize.bool(params["ageGated"]);
if (params["directLending"] !== undefined)
data["DirectLending"] = serialize.bool(params["directLending"]);
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new UsAppToPersonInstance(operationVersion, response.body, instance._solution.messagingServiceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new UsAppToPersonPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new UsAppToPersonPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
if (params["xTwilioApiVersion"] !== undefined)
headers["X-Twilio-Api-Version"] = params["xTwilioApiVersion"];
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new UsAppToPersonPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new UsAppToPersonPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class UsAppToPersonPage extends Page_1.default {
/**
* Initialize the UsAppToPersonPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of UsAppToPersonInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new UsAppToPersonInstance(this._version, payload, this._solution.messagingServiceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsAppToPersonPage = UsAppToPersonPage;

View File

@@ -0,0 +1,79 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to fetch a UsAppToPersonUsecaseInstance
*/
export interface UsAppToPersonUsecaseListInstanceFetchOptions {
/** The unique string to identify the A2P brand. */
brandRegistrationSid?: string;
}
export interface UsAppToPersonUsecaseSolution {
messagingServiceSid: string;
}
export interface UsAppToPersonUsecaseListInstance {
_version: V1;
_solution: UsAppToPersonUsecaseSolution;
_uri: string;
/**
* Fetch a UsAppToPersonUsecaseInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonUsecaseInstance
*/
fetch(callback?: (error: Error | null, item?: UsAppToPersonUsecaseInstance) => any): Promise<UsAppToPersonUsecaseInstance>;
/**
* Fetch a UsAppToPersonUsecaseInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonUsecaseInstance
*/
fetch(params: UsAppToPersonUsecaseListInstanceFetchOptions, callback?: (error: Error | null, item?: UsAppToPersonUsecaseInstance) => any): Promise<UsAppToPersonUsecaseInstance>;
/**
* Fetch a UsAppToPersonUsecaseInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonUsecaseInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonUsecaseInstance>) => any): Promise<ApiResponse<UsAppToPersonUsecaseInstance>>;
/**
* Fetch a UsAppToPersonUsecaseInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsAppToPersonUsecaseInstance with HTTP metadata
*/
fetchWithHttpInfo(params: UsAppToPersonUsecaseListInstanceFetchOptions, callback?: (error: Error | null, item?: ApiResponse<UsAppToPersonUsecaseInstance>) => any): Promise<ApiResponse<UsAppToPersonUsecaseInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function UsAppToPersonUsecaseListInstance(version: V1, messagingServiceSid: string): UsAppToPersonUsecaseListInstance;
interface UsAppToPersonUsecaseResource {
us_app_to_person_usecases: Array<any>;
}
export declare class UsAppToPersonUsecaseInstance {
protected _version: V1;
constructor(_version: V1, payload: UsAppToPersonUsecaseResource, messagingServiceSid: string);
/**
* Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases.
*/
usAppToPersonUsecases: Array<any>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
usAppToPersonUsecases: any[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,109 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsAppToPersonUsecaseInstance = void 0;
exports.UsAppToPersonUsecaseListInstance = UsAppToPersonUsecaseListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
function UsAppToPersonUsecaseListInstance(version, messagingServiceSid) {
if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) {
throw new Error("Parameter 'messagingServiceSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { messagingServiceSid };
instance._uri = `/Services/${messagingServiceSid}/Compliance/Usa2p/Usecases`;
instance.fetch = function fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["brandRegistrationSid"] !== undefined)
data["BrandRegistrationSid"] = params["brandRegistrationSid"];
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new UsAppToPersonUsecaseInstance(operationVersion, payload, instance._solution.messagingServiceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.fetchWithHttpInfo = function fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["brandRegistrationSid"] !== undefined)
data["BrandRegistrationSid"] = params["brandRegistrationSid"];
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new UsAppToPersonUsecaseInstance(operationVersion, response.body, instance._solution.messagingServiceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class UsAppToPersonUsecaseInstance {
constructor(_version, payload, messagingServiceSid) {
this._version = _version;
this.usAppToPersonUsecases = payload.us_app_to_person_usecases;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
usAppToPersonUsecases: this.usAppToPersonUsecases,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsAppToPersonUsecaseInstance = UsAppToPersonUsecaseInstance;

View File

@@ -0,0 +1,873 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The organizational authority for business registrations. Required for all business types except SOLE_PROPRIETOR.
*/
export type TollfreeVerificationBusinessRegistrationAuthority = "EIN" | "CBN" | "CRN" | "PROVINCIAL_NUMBER" | "VAT" | "ACN" | "ABN" | "BRN" | "SIREN" | "SIRET" | "NZBN" | "USt-IdNr" | "CIF" | "NIF" | "CNPJ" | "UID" | "NEQ" | "OTHER";
/**
* The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT. Required field.
*/
export type TollfreeVerificationBusinessType = "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "SOLE_PROPRIETOR" | "NON_PROFIT" | "GOVERNMENT";
/**
* Describe how a user opts-in to text messages.
*/
export type TollfreeVerificationOptInType = "VERBAL" | "WEB_FORM" | "PAPER_FORM" | "VIA_TEXT" | "MOBILE_QR_CODE" | "IMPORT" | "IMPORT_PLEASE_REPLACE";
/**
* The compliance status of the Tollfree Verification record.
*/
export type TollfreeVerificationStatus = "PENDING_REVIEW" | "IN_REVIEW" | "TWILIO_APPROVED" | "TWILIO_REJECTED";
/**
* The third-party political vetting provider.
*/
export type TollfreeVerificationVettingProvider = "CAMPAIGN_VERIFY";
/**
* Options to pass to update a TollfreeVerificationInstance
*/
export interface TollfreeVerificationContextUpdateOptions {
/** The name of the business or organization using the Tollfree number. */
businessName?: string;
/** The website of the business or organization using the Tollfree number. */
businessWebsite?: string;
/** The email address to receive the notification about the verification result. . */
notificationEmail?: string;
/** The category of the use case for the Tollfree Number. List as many as are applicable. */
useCaseCategories?: Array<string>;
/** Use this to further explain how messaging is used by the business or organization. */
useCaseSummary?: string;
/** An example of message content, i.e. a sample message. */
productionMessageSample?: string;
/** Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */
optInImageUrls?: Array<string>;
/** */
optInType?: TollfreeVerificationOptInType;
/** Estimate monthly volume of messages from the Tollfree Number. */
messageVolume?: string;
/** The address of the business or organization using the Tollfree number. */
businessStreetAddress?: string;
/** The address of the business or organization using the Tollfree number. */
businessStreetAddress2?: string;
/** The city of the business or organization using the Tollfree number. */
businessCity?: string;
/** The state/province/region of the business or organization using the Tollfree number. */
businessStateProvinceRegion?: string;
/** The postal code of the business or organization using the Tollfree number. */
businessPostalCode?: string;
/** The country of the business or organization using the Tollfree number. */
businessCountry?: string;
/** Additional information to be provided for verification. */
additionalInformation?: string;
/** The first name of the contact for the business or organization using the Tollfree number. */
businessContactFirstName?: string;
/** The last name of the contact for the business or organization using the Tollfree number. */
businessContactLastName?: string;
/** The email address of the contact for the business or organization using the Tollfree number. */
businessContactEmail?: string;
/** The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. */
businessContactPhone?: string;
/** Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to \\\'Website fixed\\\'. */
editReason?: string;
/** A legally recognized business registration number */
businessRegistrationNumber?: string;
/** */
businessRegistrationAuthority?: TollfreeVerificationBusinessRegistrationAuthority;
/** Country business is registered in */
businessRegistrationCountry?: string;
/** */
businessType?: TollfreeVerificationBusinessType;
/** The E.164 formatted number associated with the business. */
businessRegistrationPhoneNumber?: string;
/** Trade name, sub entity, or downstream business name of business being submitted for verification */
doingBusinessAs?: string;
/** The confirmation message sent to users when they opt in to receive messages. */
optInConfirmationMessage?: string;
/** A sample help message provided to users. */
helpMessageSample?: string;
/** The URL to the privacy policy for the business or organization. */
privacyPolicyUrl?: string;
/** The URL to the terms and conditions for the business or organization. */
termsAndConditionsUrl?: string;
/** Indicates if the content is age gated. */
ageGatedContent?: boolean;
/** List of keywords that users can text in to opt in to receive messages. */
optInKeywords?: Array<string>;
/** */
vettingProvider?: TollfreeVerificationVettingProvider;
/** The unique ID of the vetting */
vettingId?: string;
}
/**
* Options to pass to create a TollfreeVerificationInstance
*/
export interface TollfreeVerificationListInstanceCreateOptions {
/** The name of the business or organization using the Tollfree number. */
businessName: string;
/** The website of the business or organization using the Tollfree number. */
businessWebsite: string;
/** The email address to receive the notification about the verification result. . */
notificationEmail: string;
/** The category of the use case for the Tollfree Number. List as many as are applicable. */
useCaseCategories: Array<string>;
/** Use this to further explain how messaging is used by the business or organization. */
useCaseSummary: string;
/** An example of message content, i.e. a sample message. */
productionMessageSample: string;
/** Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */
optInImageUrls: Array<string>;
/** */
optInType: TollfreeVerificationOptInType;
/** Estimate monthly volume of messages from the Tollfree Number. */
messageVolume: string;
/** The SID of the Phone Number associated with the Tollfree Verification. */
tollfreePhoneNumberSid: string;
/** Customer\\\'s Profile Bundle BundleSid. */
customerProfileSid?: string;
/** The address of the business or organization using the Tollfree number. */
businessStreetAddress?: string;
/** The address of the business or organization using the Tollfree number. */
businessStreetAddress2?: string;
/** The city of the business or organization using the Tollfree number. */
businessCity?: string;
/** The state/province/region of the business or organization using the Tollfree number. */
businessStateProvinceRegion?: string;
/** The postal code of the business or organization using the Tollfree number. */
businessPostalCode?: string;
/** The country of the business or organization using the Tollfree number. */
businessCountry?: string;
/** Additional information to be provided for verification. */
additionalInformation?: string;
/** The first name of the contact for the business or organization using the Tollfree number. */
businessContactFirstName?: string;
/** The last name of the contact for the business or organization using the Tollfree number. */
businessContactLastName?: string;
/** The email address of the contact for the business or organization using the Tollfree number. */
businessContactEmail?: string;
/** The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. */
businessContactPhone?: string;
/** An optional external reference ID supplied by customer and echoed back on status retrieval. */
externalReferenceId?: string;
/** A legally recognized business registration number. Required for all business types except SOLE_PROPRIETOR. */
businessRegistrationNumber?: string;
/** */
businessRegistrationAuthority?: TollfreeVerificationBusinessRegistrationAuthority;
/** The country where the business is registered. Required for all business types except SOLE_PROPRIETOR. */
businessRegistrationCountry?: string;
/** */
businessType?: TollfreeVerificationBusinessType;
/** The E.164 formatted number associated with the business. */
businessRegistrationPhoneNumber?: string;
/** Trade name, sub entity, or downstream business name of business being submitted for verification */
doingBusinessAs?: string;
/** The confirmation message sent to users when they opt in to receive messages. */
optInConfirmationMessage?: string;
/** A sample help message provided to users. */
helpMessageSample?: string;
/** The URL to the privacy policy for the business or organization. */
privacyPolicyUrl?: string;
/** The URL to the terms and conditions for the business or organization. */
termsAndConditionsUrl?: string;
/** Indicates if the content is age gated. */
ageGatedContent?: boolean;
/** List of keywords that users can text in to opt in to receive messages. */
optInKeywords?: Array<string>;
/** */
vettingProvider?: TollfreeVerificationVettingProvider;
/** The unique ID of the vetting */
vettingId?: string;
}
/**
* Options to pass to each
*/
export interface TollfreeVerificationListInstanceEachOptions {
/** The SID of the Phone Number associated with the Tollfree Verification. */
tollfreePhoneNumberSid?: string;
/** The compliance status of the Tollfree Verification record. */
status?: TollfreeVerificationStatus;
/** Customer supplied reference id for the Tollfree Verification record. */
externalReferenceId?: string;
/** Whether to include Tollfree Verifications from sub accounts in list response. */
includeSubAccounts?: boolean;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The trust product sids / tollfree bundle sids of tollfree verifications */
trustProductSid?: Array<string>;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface TollfreeVerificationListInstanceOptions {
/** The SID of the Phone Number associated with the Tollfree Verification. */
tollfreePhoneNumberSid?: string;
/** The compliance status of the Tollfree Verification record. */
status?: TollfreeVerificationStatus;
/** Customer supplied reference id for the Tollfree Verification record. */
externalReferenceId?: string;
/** Whether to include Tollfree Verifications from sub accounts in list response. */
includeSubAccounts?: boolean;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The trust product sids / tollfree bundle sids of tollfree verifications */
trustProductSid?: Array<string>;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface TollfreeVerificationListInstancePageOptions {
/** The SID of the Phone Number associated with the Tollfree Verification. */
tollfreePhoneNumberSid?: string;
/** The compliance status of the Tollfree Verification record. */
status?: TollfreeVerificationStatus;
/** Customer supplied reference id for the Tollfree Verification record. */
externalReferenceId?: string;
/** Whether to include Tollfree Verifications from sub accounts in list response. */
includeSubAccounts?: boolean;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The trust product sids / tollfree bundle sids of tollfree verifications */
trustProductSid?: Array<string>;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface TollfreeVerificationContext {
/**
* Remove a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
fetch(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Fetch a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Update a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
update(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Update a TollfreeVerificationInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
update(params: TollfreeVerificationContextUpdateOptions, callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Update a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Update a TollfreeVerificationInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
updateWithHttpInfo(params: TollfreeVerificationContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TollfreeVerificationContextSolution {
sid: string;
}
export declare class TollfreeVerificationContextImpl implements TollfreeVerificationContext {
protected _version: V1;
protected _solution: TollfreeVerificationContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
update(params?: TollfreeVerificationContextUpdateOptions | ((error: Error | null, item?: TollfreeVerificationInstance) => any), callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
updateWithHttpInfo(params?: TollfreeVerificationContextUpdateOptions | ((error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TollfreeVerificationContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TollfreeVerificationPayload extends TwilioResponsePayload {
verifications: TollfreeVerificationResource[];
}
interface TollfreeVerificationResource {
sid: string;
account_sid: string;
customer_profile_sid: string;
trust_product_sid: string;
date_created: Date;
date_updated: Date;
regulated_item_sid: string;
business_name: string;
business_street_address: string;
business_street_address2: string;
business_city: string;
business_state_province_region: string;
business_postal_code: string;
business_country: string;
business_website: string;
business_contact_first_name: string;
business_contact_last_name: string;
business_contact_email: string;
business_contact_phone: string;
notification_email: string;
use_case_categories: Array<string>;
use_case_summary: string;
production_message_sample: string;
opt_in_image_urls: Array<string>;
opt_in_type: TollfreeVerificationOptInType;
message_volume: string;
additional_information: string;
tollfree_phone_number_sid: string;
tollfree_phone_number: string;
status: TollfreeVerificationStatus;
url: string;
rejection_reason: string;
error_code: number;
edit_expiration: Date;
edit_allowed: boolean;
business_registration_number: string;
business_registration_authority: TollfreeVerificationBusinessRegistrationAuthority;
business_registration_country: string;
business_type: TollfreeVerificationBusinessType;
business_registration_phone_number: string;
doing_business_as: string;
opt_in_confirmation_message: string;
help_message_sample: string;
privacy_policy_url: string;
terms_and_conditions_url: string;
age_gated_content: boolean;
opt_in_keywords: Array<string>;
rejection_reasons: Array<any>;
resource_links: any;
external_reference_id: string;
vetting_id: string;
vetting_provider: TollfreeVerificationVettingProvider;
vetting_id_expiration: Date;
}
export declare class TollfreeVerificationInstance {
protected _version: V1;
protected _solution: TollfreeVerificationContextSolution;
protected _context?: TollfreeVerificationContext;
constructor(_version: V1, payload: TollfreeVerificationResource, sid?: string);
/**
* The unique string to identify Tollfree Verification.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tollfree Verification resource.
*/
accountSid: string;
/**
* Customer\'s Profile Bundle BundleSid.
*/
customerProfileSid: string;
/**
* Tollfree TrustProduct Bundle BundleSid.
*/
trustProductSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The SID of the Regulated Item.
*/
regulatedItemSid: string;
/**
* The name of the business or organization using the Tollfree number.
*/
businessName: string;
/**
* The address of the business or organization using the Tollfree number.
*/
businessStreetAddress: string;
/**
* The address of the business or organization using the Tollfree number.
*/
businessStreetAddress2: string;
/**
* The city of the business or organization using the Tollfree number.
*/
businessCity: string;
/**
* The state/province/region of the business or organization using the Tollfree number.
*/
businessStateProvinceRegion: string;
/**
* The postal code of the business or organization using the Tollfree number.
*/
businessPostalCode: string;
/**
* The country of the business or organization using the Tollfree number.
*/
businessCountry: string;
/**
* The website of the business or organization using the Tollfree number.
*/
businessWebsite: string;
/**
* The first name of the contact for the business or organization using the Tollfree number.
*/
businessContactFirstName: string;
/**
* The last name of the contact for the business or organization using the Tollfree number.
*/
businessContactLastName: string;
/**
* The email address of the contact for the business or organization using the Tollfree number.
*/
businessContactEmail: string;
/**
* The E.164 formatted phone number of the contact for the business or organization using the Tollfree number.
*/
businessContactPhone: string;
/**
* The email address to receive the notification about the verification result. .
*/
notificationEmail: string;
/**
* The category of the use case for the Tollfree Number. List as many as are applicable.
*/
useCaseCategories: Array<string>;
/**
* Use this to further explain how messaging is used by the business or organization.
*/
useCaseSummary: string;
/**
* An example of message content, i.e. a sample message.
*/
productionMessageSample: string;
/**
* Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL.
*/
optInImageUrls: Array<string>;
optInType: TollfreeVerificationOptInType;
/**
* Estimate monthly volume of messages from the Tollfree Number.
*/
messageVolume: string;
/**
* Additional information to be provided for verification.
*/
additionalInformation: string;
/**
* The SID of the Phone Number associated with the Tollfree Verification.
*/
tollfreePhoneNumberSid: string;
/**
* The E.164 formatted toll-free phone number associated with the verification.
*/
tollfreePhoneNumber: string;
status: TollfreeVerificationStatus;
/**
* The absolute URL of the Tollfree Verification resource.
*/
url: string;
/**
* The rejection reason given when a Tollfree Verification has been rejected.
*/
rejectionReason: string;
/**
* The error code given when a Tollfree Verification has been rejected.
*/
errorCode: number;
/**
* The date and time when the ability to edit a rejected verification expires.
*/
editExpiration: Date;
/**
* If a rejected verification is allowed to be edited/resubmitted. Some rejection reasons allow editing and some do not.
*/
editAllowed: boolean;
/**
* A legally recognized business registration number
*/
businessRegistrationNumber: string;
businessRegistrationAuthority: TollfreeVerificationBusinessRegistrationAuthority;
/**
* Country business is registered in
*/
businessRegistrationCountry: string;
businessType: TollfreeVerificationBusinessType;
/**
* The E.164 formatted number associated with the business.
*/
businessRegistrationPhoneNumber: string;
/**
* Trade name, sub entity, or downstream business name of business being submitted for verification
*/
doingBusinessAs: string;
/**
* The confirmation message sent to users when they opt in to receive messages.
*/
optInConfirmationMessage: string;
/**
* A sample help message provided to users.
*/
helpMessageSample: string;
/**
* The URL to the privacy policy for the business or organization.
*/
privacyPolicyUrl: string;
/**
* The URL of the terms and conditions for the business or organization.
*/
termsAndConditionsUrl: string;
/**
* Indicates if the content is age gated.
*/
ageGatedContent: boolean;
/**
* List of keywords that users can send to opt in or out of messages.
*/
optInKeywords: Array<string>;
/**
* A list of rejection reasons and codes describing why a Tollfree Verification has been rejected.
*/
rejectionReasons: Array<any>;
/**
* The URLs of the documents associated with the Tollfree Verification resource.
*/
resourceLinks: any;
/**
* An optional external reference ID supplied by customer and echoed back on status retrieval.
*/
externalReferenceId: string;
vettingId: string;
vettingProvider: TollfreeVerificationVettingProvider;
vettingIdExpiration: Date;
private get _proxy();
/**
* Remove a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
fetch(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Fetch a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Update a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
update(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Update a TollfreeVerificationInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
update(params: TollfreeVerificationContextUpdateOptions, callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Update a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Update a TollfreeVerificationInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
updateWithHttpInfo(params: TollfreeVerificationContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
customerProfileSid: string;
trustProductSid: string;
dateCreated: Date;
dateUpdated: Date;
regulatedItemSid: string;
businessName: string;
businessStreetAddress: string;
businessStreetAddress2: string;
businessCity: string;
businessStateProvinceRegion: string;
businessPostalCode: string;
businessCountry: string;
businessWebsite: string;
businessContactFirstName: string;
businessContactLastName: string;
businessContactEmail: string;
businessContactPhone: string;
notificationEmail: string;
useCaseCategories: string[];
useCaseSummary: string;
productionMessageSample: string;
optInImageUrls: string[];
optInType: TollfreeVerificationOptInType;
messageVolume: string;
additionalInformation: string;
tollfreePhoneNumberSid: string;
tollfreePhoneNumber: string;
status: TollfreeVerificationStatus;
url: string;
rejectionReason: string;
errorCode: number;
editExpiration: Date;
editAllowed: boolean;
businessRegistrationNumber: string;
businessRegistrationAuthority: TollfreeVerificationBusinessRegistrationAuthority;
businessRegistrationCountry: string;
businessType: TollfreeVerificationBusinessType;
businessRegistrationPhoneNumber: string;
doingBusinessAs: string;
optInConfirmationMessage: string;
helpMessageSample: string;
privacyPolicyUrl: string;
termsAndConditionsUrl: string;
ageGatedContent: boolean;
optInKeywords: string[];
rejectionReasons: any[];
resourceLinks: any;
externalReferenceId: string;
vettingId: string;
vettingProvider: "CAMPAIGN_VERIFY";
vettingIdExpiration: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TollfreeVerificationSolution {
}
export interface TollfreeVerificationListInstance {
_version: V1;
_solution: TollfreeVerificationSolution;
_uri: string;
(sid: string): TollfreeVerificationContext;
get(sid: string): TollfreeVerificationContext;
/**
* Create a TollfreeVerificationInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
create(params: TollfreeVerificationListInstanceCreateOptions, callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>;
/**
* Create a TollfreeVerificationInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
createWithHttpInfo(params: TollfreeVerificationListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TollfreeVerificationInstance>) => any): Promise<ApiResponse<TollfreeVerificationInstance>>;
/**
* Streams TollfreeVerificationInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { TollfreeVerificationListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void): void;
each(params: TollfreeVerificationListInstanceEachOptions, callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TollfreeVerificationInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { TollfreeVerificationListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TollfreeVerificationListInstanceEachOptions, callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TollfreeVerificationInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: TollfreeVerificationPage) => any): Promise<TollfreeVerificationPage>;
/**
* Retrieve a single target page of TollfreeVerificationInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<TollfreeVerificationPage>) => any): Promise<ApiResponse<TollfreeVerificationPage>>;
/**
* Lists TollfreeVerificationInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { TollfreeVerificationListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TollfreeVerificationInstance[]) => any): Promise<TollfreeVerificationInstance[]>;
list(params: TollfreeVerificationListInstanceOptions, callback?: (error: Error | null, items: TollfreeVerificationInstance[]) => any): Promise<TollfreeVerificationInstance[]>;
/**
* Lists TollfreeVerificationInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { TollfreeVerificationListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TollfreeVerificationInstance[]>) => any): Promise<ApiResponse<TollfreeVerificationInstance[]>>;
listWithHttpInfo(params: TollfreeVerificationListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TollfreeVerificationInstance[]>) => any): Promise<ApiResponse<TollfreeVerificationInstance[]>>;
/**
* Retrieve a single page of TollfreeVerificationInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { TollfreeVerificationListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TollfreeVerificationPage) => any): Promise<TollfreeVerificationPage>;
page(params: TollfreeVerificationListInstancePageOptions, callback?: (error: Error | null, items: TollfreeVerificationPage) => any): Promise<TollfreeVerificationPage>;
/**
* Retrieve a single page of TollfreeVerificationInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { TollfreeVerificationListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TollfreeVerificationPage>) => any): Promise<ApiResponse<TollfreeVerificationPage>>;
pageWithHttpInfo(params: TollfreeVerificationListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TollfreeVerificationPage>) => any): Promise<ApiResponse<TollfreeVerificationPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TollfreeVerificationListInstance(version: V1): TollfreeVerificationListInstance;
export declare class TollfreeVerificationPage extends Page<V1, TollfreeVerificationPayload, TollfreeVerificationResource, TollfreeVerificationInstance> {
/**
* Initialize the TollfreeVerificationPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TollfreeVerificationSolution);
/**
* Build an instance of TollfreeVerificationInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TollfreeVerificationResource): TollfreeVerificationInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,885 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TollfreeVerificationPage = exports.TollfreeVerificationInstance = exports.TollfreeVerificationContextImpl = void 0;
exports.TollfreeVerificationListInstance = TollfreeVerificationListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class TollfreeVerificationContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Tollfree/Verifications/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new TollfreeVerificationInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new TollfreeVerificationInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["businessName"] !== undefined)
data["BusinessName"] = params["businessName"];
if (params["businessWebsite"] !== undefined)
data["BusinessWebsite"] = params["businessWebsite"];
if (params["notificationEmail"] !== undefined)
data["NotificationEmail"] = params["notificationEmail"];
if (params["useCaseCategories"] !== undefined)
data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e);
if (params["useCaseSummary"] !== undefined)
data["UseCaseSummary"] = params["useCaseSummary"];
if (params["productionMessageSample"] !== undefined)
data["ProductionMessageSample"] = params["productionMessageSample"];
if (params["optInImageUrls"] !== undefined)
data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e);
if (params["optInType"] !== undefined)
data["OptInType"] = params["optInType"];
if (params["messageVolume"] !== undefined)
data["MessageVolume"] = params["messageVolume"];
if (params["businessStreetAddress"] !== undefined)
data["BusinessStreetAddress"] = params["businessStreetAddress"];
if (params["businessStreetAddress2"] !== undefined)
data["BusinessStreetAddress2"] = params["businessStreetAddress2"];
if (params["businessCity"] !== undefined)
data["BusinessCity"] = params["businessCity"];
if (params["businessStateProvinceRegion"] !== undefined)
data["BusinessStateProvinceRegion"] =
params["businessStateProvinceRegion"];
if (params["businessPostalCode"] !== undefined)
data["BusinessPostalCode"] = params["businessPostalCode"];
if (params["businessCountry"] !== undefined)
data["BusinessCountry"] = params["businessCountry"];
if (params["additionalInformation"] !== undefined)
data["AdditionalInformation"] = params["additionalInformation"];
if (params["businessContactFirstName"] !== undefined)
data["BusinessContactFirstName"] = params["businessContactFirstName"];
if (params["businessContactLastName"] !== undefined)
data["BusinessContactLastName"] = params["businessContactLastName"];
if (params["businessContactEmail"] !== undefined)
data["BusinessContactEmail"] = params["businessContactEmail"];
if (params["businessContactPhone"] !== undefined)
data["BusinessContactPhone"] = params["businessContactPhone"];
if (params["editReason"] !== undefined)
data["EditReason"] = params["editReason"];
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessRegistrationCountry"] !== undefined)
data["BusinessRegistrationCountry"] =
params["businessRegistrationCountry"];
if (params["businessType"] !== undefined)
data["BusinessType"] = params["businessType"];
if (params["businessRegistrationPhoneNumber"] !== undefined)
data["BusinessRegistrationPhoneNumber"] =
params["businessRegistrationPhoneNumber"];
if (params["doingBusinessAs"] !== undefined)
data["DoingBusinessAs"] = params["doingBusinessAs"];
if (params["optInConfirmationMessage"] !== undefined)
data["OptInConfirmationMessage"] = params["optInConfirmationMessage"];
if (params["helpMessageSample"] !== undefined)
data["HelpMessageSample"] = params["helpMessageSample"];
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
if (params["ageGatedContent"] !== undefined)
data["AgeGatedContent"] = serialize.bool(params["ageGatedContent"]);
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new TollfreeVerificationInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["businessName"] !== undefined)
data["BusinessName"] = params["businessName"];
if (params["businessWebsite"] !== undefined)
data["BusinessWebsite"] = params["businessWebsite"];
if (params["notificationEmail"] !== undefined)
data["NotificationEmail"] = params["notificationEmail"];
if (params["useCaseCategories"] !== undefined)
data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e);
if (params["useCaseSummary"] !== undefined)
data["UseCaseSummary"] = params["useCaseSummary"];
if (params["productionMessageSample"] !== undefined)
data["ProductionMessageSample"] = params["productionMessageSample"];
if (params["optInImageUrls"] !== undefined)
data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e);
if (params["optInType"] !== undefined)
data["OptInType"] = params["optInType"];
if (params["messageVolume"] !== undefined)
data["MessageVolume"] = params["messageVolume"];
if (params["businessStreetAddress"] !== undefined)
data["BusinessStreetAddress"] = params["businessStreetAddress"];
if (params["businessStreetAddress2"] !== undefined)
data["BusinessStreetAddress2"] = params["businessStreetAddress2"];
if (params["businessCity"] !== undefined)
data["BusinessCity"] = params["businessCity"];
if (params["businessStateProvinceRegion"] !== undefined)
data["BusinessStateProvinceRegion"] =
params["businessStateProvinceRegion"];
if (params["businessPostalCode"] !== undefined)
data["BusinessPostalCode"] = params["businessPostalCode"];
if (params["businessCountry"] !== undefined)
data["BusinessCountry"] = params["businessCountry"];
if (params["additionalInformation"] !== undefined)
data["AdditionalInformation"] = params["additionalInformation"];
if (params["businessContactFirstName"] !== undefined)
data["BusinessContactFirstName"] = params["businessContactFirstName"];
if (params["businessContactLastName"] !== undefined)
data["BusinessContactLastName"] = params["businessContactLastName"];
if (params["businessContactEmail"] !== undefined)
data["BusinessContactEmail"] = params["businessContactEmail"];
if (params["businessContactPhone"] !== undefined)
data["BusinessContactPhone"] = params["businessContactPhone"];
if (params["editReason"] !== undefined)
data["EditReason"] = params["editReason"];
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessRegistrationCountry"] !== undefined)
data["BusinessRegistrationCountry"] =
params["businessRegistrationCountry"];
if (params["businessType"] !== undefined)
data["BusinessType"] = params["businessType"];
if (params["businessRegistrationPhoneNumber"] !== undefined)
data["BusinessRegistrationPhoneNumber"] =
params["businessRegistrationPhoneNumber"];
if (params["doingBusinessAs"] !== undefined)
data["DoingBusinessAs"] = params["doingBusinessAs"];
if (params["optInConfirmationMessage"] !== undefined)
data["OptInConfirmationMessage"] = params["optInConfirmationMessage"];
if (params["helpMessageSample"] !== undefined)
data["HelpMessageSample"] = params["helpMessageSample"];
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
if (params["ageGatedContent"] !== undefined)
data["AgeGatedContent"] = serialize.bool(params["ageGatedContent"]);
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new TollfreeVerificationInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TollfreeVerificationContextImpl = TollfreeVerificationContextImpl;
class TollfreeVerificationInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.customerProfileSid = payload.customer_profile_sid;
this.trustProductSid = payload.trust_product_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.regulatedItemSid = payload.regulated_item_sid;
this.businessName = payload.business_name;
this.businessStreetAddress = payload.business_street_address;
this.businessStreetAddress2 = payload.business_street_address2;
this.businessCity = payload.business_city;
this.businessStateProvinceRegion = payload.business_state_province_region;
this.businessPostalCode = payload.business_postal_code;
this.businessCountry = payload.business_country;
this.businessWebsite = payload.business_website;
this.businessContactFirstName = payload.business_contact_first_name;
this.businessContactLastName = payload.business_contact_last_name;
this.businessContactEmail = payload.business_contact_email;
this.businessContactPhone = payload.business_contact_phone;
this.notificationEmail = payload.notification_email;
this.useCaseCategories = payload.use_case_categories;
this.useCaseSummary = payload.use_case_summary;
this.productionMessageSample = payload.production_message_sample;
this.optInImageUrls = payload.opt_in_image_urls;
this.optInType = payload.opt_in_type;
this.messageVolume = payload.message_volume;
this.additionalInformation = payload.additional_information;
this.tollfreePhoneNumberSid = payload.tollfree_phone_number_sid;
this.tollfreePhoneNumber = payload.tollfree_phone_number;
this.status = payload.status;
this.url = payload.url;
this.rejectionReason = payload.rejection_reason;
this.errorCode = deserialize.integer(payload.error_code);
this.editExpiration = deserialize.iso8601DateTime(payload.edit_expiration);
this.editAllowed = payload.edit_allowed;
this.businessRegistrationNumber = payload.business_registration_number;
this.businessRegistrationAuthority =
payload.business_registration_authority;
this.businessRegistrationCountry = payload.business_registration_country;
this.businessType = payload.business_type;
this.businessRegistrationPhoneNumber =
payload.business_registration_phone_number;
this.doingBusinessAs = payload.doing_business_as;
this.optInConfirmationMessage = payload.opt_in_confirmation_message;
this.helpMessageSample = payload.help_message_sample;
this.privacyPolicyUrl = payload.privacy_policy_url;
this.termsAndConditionsUrl = payload.terms_and_conditions_url;
this.ageGatedContent = payload.age_gated_content;
this.optInKeywords = payload.opt_in_keywords;
this.rejectionReasons = payload.rejection_reasons;
this.resourceLinks = payload.resource_links;
this.externalReferenceId = payload.external_reference_id;
this.vettingId = payload.vetting_id;
this.vettingProvider = payload.vetting_provider;
this.vettingIdExpiration = deserialize.iso8601DateTime(payload.vetting_id_expiration);
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new TollfreeVerificationContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a TollfreeVerificationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TollfreeVerificationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TollfreeVerificationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
customerProfileSid: this.customerProfileSid,
trustProductSid: this.trustProductSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
regulatedItemSid: this.regulatedItemSid,
businessName: this.businessName,
businessStreetAddress: this.businessStreetAddress,
businessStreetAddress2: this.businessStreetAddress2,
businessCity: this.businessCity,
businessStateProvinceRegion: this.businessStateProvinceRegion,
businessPostalCode: this.businessPostalCode,
businessCountry: this.businessCountry,
businessWebsite: this.businessWebsite,
businessContactFirstName: this.businessContactFirstName,
businessContactLastName: this.businessContactLastName,
businessContactEmail: this.businessContactEmail,
businessContactPhone: this.businessContactPhone,
notificationEmail: this.notificationEmail,
useCaseCategories: this.useCaseCategories,
useCaseSummary: this.useCaseSummary,
productionMessageSample: this.productionMessageSample,
optInImageUrls: this.optInImageUrls,
optInType: this.optInType,
messageVolume: this.messageVolume,
additionalInformation: this.additionalInformation,
tollfreePhoneNumberSid: this.tollfreePhoneNumberSid,
tollfreePhoneNumber: this.tollfreePhoneNumber,
status: this.status,
url: this.url,
rejectionReason: this.rejectionReason,
errorCode: this.errorCode,
editExpiration: this.editExpiration,
editAllowed: this.editAllowed,
businessRegistrationNumber: this.businessRegistrationNumber,
businessRegistrationAuthority: this.businessRegistrationAuthority,
businessRegistrationCountry: this.businessRegistrationCountry,
businessType: this.businessType,
businessRegistrationPhoneNumber: this.businessRegistrationPhoneNumber,
doingBusinessAs: this.doingBusinessAs,
optInConfirmationMessage: this.optInConfirmationMessage,
helpMessageSample: this.helpMessageSample,
privacyPolicyUrl: this.privacyPolicyUrl,
termsAndConditionsUrl: this.termsAndConditionsUrl,
ageGatedContent: this.ageGatedContent,
optInKeywords: this.optInKeywords,
rejectionReasons: this.rejectionReasons,
resourceLinks: this.resourceLinks,
externalReferenceId: this.externalReferenceId,
vettingId: this.vettingId,
vettingProvider: this.vettingProvider,
vettingIdExpiration: this.vettingIdExpiration,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TollfreeVerificationInstance = TollfreeVerificationInstance;
function TollfreeVerificationListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TollfreeVerificationContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Tollfree/Verifications`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["businessName"] === null ||
params["businessName"] === undefined) {
throw new Error("Required parameter \"params['businessName']\" missing.");
}
if (params["businessWebsite"] === null ||
params["businessWebsite"] === undefined) {
throw new Error("Required parameter \"params['businessWebsite']\" missing.");
}
if (params["notificationEmail"] === null ||
params["notificationEmail"] === undefined) {
throw new Error("Required parameter \"params['notificationEmail']\" missing.");
}
if (params["useCaseCategories"] === null ||
params["useCaseCategories"] === undefined) {
throw new Error("Required parameter \"params['useCaseCategories']\" missing.");
}
if (params["useCaseSummary"] === null ||
params["useCaseSummary"] === undefined) {
throw new Error("Required parameter \"params['useCaseSummary']\" missing.");
}
if (params["productionMessageSample"] === null ||
params["productionMessageSample"] === undefined) {
throw new Error("Required parameter \"params['productionMessageSample']\" missing.");
}
if (params["optInImageUrls"] === null ||
params["optInImageUrls"] === undefined) {
throw new Error("Required parameter \"params['optInImageUrls']\" missing.");
}
if (params["optInType"] === null || params["optInType"] === undefined) {
throw new Error("Required parameter \"params['optInType']\" missing.");
}
if (params["messageVolume"] === null ||
params["messageVolume"] === undefined) {
throw new Error("Required parameter \"params['messageVolume']\" missing.");
}
if (params["tollfreePhoneNumberSid"] === null ||
params["tollfreePhoneNumberSid"] === undefined) {
throw new Error("Required parameter \"params['tollfreePhoneNumberSid']\" missing.");
}
let data = {};
data["BusinessName"] = params["businessName"];
data["BusinessWebsite"] = params["businessWebsite"];
data["NotificationEmail"] = params["notificationEmail"];
data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e);
data["UseCaseSummary"] = params["useCaseSummary"];
data["ProductionMessageSample"] = params["productionMessageSample"];
data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e);
data["OptInType"] = params["optInType"];
data["MessageVolume"] = params["messageVolume"];
data["TollfreePhoneNumberSid"] = params["tollfreePhoneNumberSid"];
if (params["customerProfileSid"] !== undefined)
data["CustomerProfileSid"] = params["customerProfileSid"];
if (params["businessStreetAddress"] !== undefined)
data["BusinessStreetAddress"] = params["businessStreetAddress"];
if (params["businessStreetAddress2"] !== undefined)
data["BusinessStreetAddress2"] = params["businessStreetAddress2"];
if (params["businessCity"] !== undefined)
data["BusinessCity"] = params["businessCity"];
if (params["businessStateProvinceRegion"] !== undefined)
data["BusinessStateProvinceRegion"] =
params["businessStateProvinceRegion"];
if (params["businessPostalCode"] !== undefined)
data["BusinessPostalCode"] = params["businessPostalCode"];
if (params["businessCountry"] !== undefined)
data["BusinessCountry"] = params["businessCountry"];
if (params["additionalInformation"] !== undefined)
data["AdditionalInformation"] = params["additionalInformation"];
if (params["businessContactFirstName"] !== undefined)
data["BusinessContactFirstName"] = params["businessContactFirstName"];
if (params["businessContactLastName"] !== undefined)
data["BusinessContactLastName"] = params["businessContactLastName"];
if (params["businessContactEmail"] !== undefined)
data["BusinessContactEmail"] = params["businessContactEmail"];
if (params["businessContactPhone"] !== undefined)
data["BusinessContactPhone"] = params["businessContactPhone"];
if (params["externalReferenceId"] !== undefined)
data["ExternalReferenceId"] = params["externalReferenceId"];
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessRegistrationCountry"] !== undefined)
data["BusinessRegistrationCountry"] =
params["businessRegistrationCountry"];
if (params["businessType"] !== undefined)
data["BusinessType"] = params["businessType"];
if (params["businessRegistrationPhoneNumber"] !== undefined)
data["BusinessRegistrationPhoneNumber"] =
params["businessRegistrationPhoneNumber"];
if (params["doingBusinessAs"] !== undefined)
data["DoingBusinessAs"] = params["doingBusinessAs"];
if (params["optInConfirmationMessage"] !== undefined)
data["OptInConfirmationMessage"] = params["optInConfirmationMessage"];
if (params["helpMessageSample"] !== undefined)
data["HelpMessageSample"] = params["helpMessageSample"];
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
if (params["ageGatedContent"] !== undefined)
data["AgeGatedContent"] = serialize.bool(params["ageGatedContent"]);
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new TollfreeVerificationInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["businessName"] === null ||
params["businessName"] === undefined) {
throw new Error("Required parameter \"params['businessName']\" missing.");
}
if (params["businessWebsite"] === null ||
params["businessWebsite"] === undefined) {
throw new Error("Required parameter \"params['businessWebsite']\" missing.");
}
if (params["notificationEmail"] === null ||
params["notificationEmail"] === undefined) {
throw new Error("Required parameter \"params['notificationEmail']\" missing.");
}
if (params["useCaseCategories"] === null ||
params["useCaseCategories"] === undefined) {
throw new Error("Required parameter \"params['useCaseCategories']\" missing.");
}
if (params["useCaseSummary"] === null ||
params["useCaseSummary"] === undefined) {
throw new Error("Required parameter \"params['useCaseSummary']\" missing.");
}
if (params["productionMessageSample"] === null ||
params["productionMessageSample"] === undefined) {
throw new Error("Required parameter \"params['productionMessageSample']\" missing.");
}
if (params["optInImageUrls"] === null ||
params["optInImageUrls"] === undefined) {
throw new Error("Required parameter \"params['optInImageUrls']\" missing.");
}
if (params["optInType"] === null || params["optInType"] === undefined) {
throw new Error("Required parameter \"params['optInType']\" missing.");
}
if (params["messageVolume"] === null ||
params["messageVolume"] === undefined) {
throw new Error("Required parameter \"params['messageVolume']\" missing.");
}
if (params["tollfreePhoneNumberSid"] === null ||
params["tollfreePhoneNumberSid"] === undefined) {
throw new Error("Required parameter \"params['tollfreePhoneNumberSid']\" missing.");
}
let data = {};
data["BusinessName"] = params["businessName"];
data["BusinessWebsite"] = params["businessWebsite"];
data["NotificationEmail"] = params["notificationEmail"];
data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e);
data["UseCaseSummary"] = params["useCaseSummary"];
data["ProductionMessageSample"] = params["productionMessageSample"];
data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e);
data["OptInType"] = params["optInType"];
data["MessageVolume"] = params["messageVolume"];
data["TollfreePhoneNumberSid"] = params["tollfreePhoneNumberSid"];
if (params["customerProfileSid"] !== undefined)
data["CustomerProfileSid"] = params["customerProfileSid"];
if (params["businessStreetAddress"] !== undefined)
data["BusinessStreetAddress"] = params["businessStreetAddress"];
if (params["businessStreetAddress2"] !== undefined)
data["BusinessStreetAddress2"] = params["businessStreetAddress2"];
if (params["businessCity"] !== undefined)
data["BusinessCity"] = params["businessCity"];
if (params["businessStateProvinceRegion"] !== undefined)
data["BusinessStateProvinceRegion"] =
params["businessStateProvinceRegion"];
if (params["businessPostalCode"] !== undefined)
data["BusinessPostalCode"] = params["businessPostalCode"];
if (params["businessCountry"] !== undefined)
data["BusinessCountry"] = params["businessCountry"];
if (params["additionalInformation"] !== undefined)
data["AdditionalInformation"] = params["additionalInformation"];
if (params["businessContactFirstName"] !== undefined)
data["BusinessContactFirstName"] = params["businessContactFirstName"];
if (params["businessContactLastName"] !== undefined)
data["BusinessContactLastName"] = params["businessContactLastName"];
if (params["businessContactEmail"] !== undefined)
data["BusinessContactEmail"] = params["businessContactEmail"];
if (params["businessContactPhone"] !== undefined)
data["BusinessContactPhone"] = params["businessContactPhone"];
if (params["externalReferenceId"] !== undefined)
data["ExternalReferenceId"] = params["externalReferenceId"];
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessRegistrationCountry"] !== undefined)
data["BusinessRegistrationCountry"] =
params["businessRegistrationCountry"];
if (params["businessType"] !== undefined)
data["BusinessType"] = params["businessType"];
if (params["businessRegistrationPhoneNumber"] !== undefined)
data["BusinessRegistrationPhoneNumber"] =
params["businessRegistrationPhoneNumber"];
if (params["doingBusinessAs"] !== undefined)
data["DoingBusinessAs"] = params["doingBusinessAs"];
if (params["optInConfirmationMessage"] !== undefined)
data["OptInConfirmationMessage"] = params["optInConfirmationMessage"];
if (params["helpMessageSample"] !== undefined)
data["HelpMessageSample"] = params["helpMessageSample"];
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
if (params["ageGatedContent"] !== undefined)
data["AgeGatedContent"] = serialize.bool(params["ageGatedContent"]);
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new TollfreeVerificationInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["tollfreePhoneNumberSid"] !== undefined)
data["TollfreePhoneNumberSid"] = params["tollfreePhoneNumberSid"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["externalReferenceId"] !== undefined)
data["ExternalReferenceId"] = params["externalReferenceId"];
if (params["includeSubAccounts"] !== undefined)
data["IncludeSubAccounts"] = serialize.bool(params["includeSubAccounts"]);
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params["trustProductSid"] !== undefined)
data["TrustProductSid"] = serialize.map(params["trustProductSid"], (e) => e);
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new TollfreeVerificationPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new TollfreeVerificationPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["tollfreePhoneNumberSid"] !== undefined)
data["TollfreePhoneNumberSid"] = params["tollfreePhoneNumberSid"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["externalReferenceId"] !== undefined)
data["ExternalReferenceId"] = params["externalReferenceId"];
if (params["includeSubAccounts"] !== undefined)
data["IncludeSubAccounts"] = serialize.bool(params["includeSubAccounts"]);
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params["trustProductSid"] !== undefined)
data["TrustProductSid"] = serialize.map(params["trustProductSid"], (e) => e);
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new TollfreeVerificationPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new TollfreeVerificationPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class TollfreeVerificationPage extends Page_1.default {
/**
* Initialize the TollfreeVerificationPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of TollfreeVerificationInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TollfreeVerificationInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TollfreeVerificationPage = TollfreeVerificationPage;

53
node_modules/twilio/lib/rest/messaging/v1/usecase.d.ts generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface UsecaseSolution {
}
export interface UsecaseListInstance {
_version: V1;
_solution: UsecaseSolution;
_uri: string;
/**
* Fetch a UsecaseInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsecaseInstance
*/
fetch(callback?: (error: Error | null, item?: UsecaseInstance) => any): Promise<UsecaseInstance>;
/**
* Fetch a UsecaseInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsecaseInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UsecaseInstance>) => any): Promise<ApiResponse<UsecaseInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function UsecaseListInstance(version: V1): UsecaseListInstance;
interface UsecaseResource {
usecases: Array<any>;
}
export declare class UsecaseInstance {
protected _version: V1;
constructor(_version: V1, payload: UsecaseResource);
/**
* Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases.
*/
usecases: Array<any>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
usecases: any[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

83
node_modules/twilio/lib/rest/messaging/v1/usecase.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsecaseInstance = void 0;
exports.UsecaseListInstance = UsecaseListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function UsecaseListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Services/Usecases`;
instance.fetch = function fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new UsecaseInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.fetchWithHttpInfo = function fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new UsecaseInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class UsecaseInstance {
constructor(_version, payload) {
this._version = _version;
this.usecases = payload.usecases;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
usecases: this.usecases,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsecaseInstance = UsecaseInstance;

View File

@@ -0,0 +1,713 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The status of the sender.
*/
export type ChannelsSenderStatus = "CREATING" | "ONLINE" | "OFFLINE" | "PENDING_VERIFICATION" | "VERIFYING" | "ONLINE:UPDATING" | "TWILIO_REVIEW" | "DRAFT" | "STUBBED";
/**
* The configuration settings for creating a sender.
*/
export declare class MessagingV2ChannelsSenderConfiguration {
/**
* The ID of the WhatsApp Business Account (WABA) to use for this sender.
*/
"wabaId"?: string | null;
/**
* The verification method.
*/
"verificationMethod"?: string | null;
/**
* The verification code.
*/
"verificationCode"?: string | null;
/**
* The SID of the Twilio Voice application.
*/
"voiceApplicationSid"?: string | null;
/**
* The account type for ISV Account Type Migration. Set to \'ISV\' or \'ISVSubAccount\' to configure, null or empty string to clear, or omit to preserve the existing value.
*/
"accountType"?: string | null;
constructor(payload: any);
}
export declare class MessagingV2ChannelsSenderOfflineReasonsItems {
/**
* The error code.
*/
"code"?: string | null;
/**
* The error message.
*/
"message"?: string | null;
/**
* The URL to get more information about the error.
*/
"moreInfo"?: string | null;
constructor(payload: any);
}
/**
* The profile information for the sender.
*/
export declare class MessagingV2ChannelsSenderProfile {
/**
* The name of the sender. Required for WhatsApp senders and must follow [Meta\'s display name guidelines](https://www.facebook.com/business/help/757569725593362).
*/
"name"?: string | null;
/**
* The profile about text for the sender.
*/
"about"?: string | null;
/**
* The address of the sender.
*/
"address"?: string | null;
/**
* The description of the sender.
*/
"description"?: string | null;
/**
* The logo URL of the sender.
*/
"logoUrl"?: string | null;
/**
* The banner URL of the sender.
*/
"bannerUrl"?: string | null;
/**
* The privacy URL of the sender. Must be a publicly accessible HTTP or HTTPS URI associated with the sender.
*/
"privacyUrl"?: string | null;
/**
* The terms of service URL of the sender.
*/
"termsOfServiceUrl"?: string | null;
/**
* The color theme of the sender. Must be in hex format and have at least a 4:5:1 contrast ratio against white.
*/
"accentColor"?: string | null;
/**
* The vertical of the sender. Allowed values are: - `Alcohol` - `Automotive` - `Beauty, Spa and Salon` - `Clothing and Apparel` - `Education` - `Entertainment` - `Event Planning and Service` - `Finance and Banking` - `Food and Grocery` - `Hotel and Lodging` - `Matrimony Service` - `Medical and Health` - `Non-profit` - `Online Gambling` - `OTC Drugs` - `Other` - `Physical Gambling` - `Professional Services` - `Public Service` - `Restaurant` - `Shopping and Retail` - `Travel and Transportation`
*/
"vertical"?: string | null;
/**
* The websites of the sender.
*/
"websites"?: any | null;
/**
* The emails of the sender.
*/
"emails"?: any | null;
/**
* The phone numbers of the sender.
*/
"phoneNumbers"?: any | null;
constructor(payload: any);
}
/**
* The profile information for the sender.
*/
export declare class MessagingV2ChannelsSenderProfileGenericResponse {
/**
* The name of the sender.
*/
"name"?: string | null;
/**
* The profile about text for the sender.
*/
"about"?: string | null;
/**
* The address of the sender.
*/
"address"?: string | null;
/**
* The description of the sender.
*/
"description"?: string | null;
/**
* The logo URL of the sender.
*/
"logoUrl"?: string | null;
/**
* The banner URL of the sender.
*/
"bannerUrl"?: string | null;
/**
* The privacy URL of the sender. Must be a publicly accessible HTTP or HTTPS URI associated with the sender.
*/
"privacyUrl"?: string | null;
/**
* The terms of service URL of the sender.
*/
"termsOfServiceUrl"?: string | null;
/**
* The color theme of the sender. Must be in hex format and have at least a 4:5:1 contrast ratio against white.
*/
"accentColor"?: string | null;
/**
* The vertical of the sender. Allowed values are: - `Alcohol` - `Automotive` - `Beauty, Spa and Salon` - `Clothing and Apparel` - `Education` - `Entertainment` - `Event Planning and Service` - `Finance and Banking` - `Food and Grocery` - `Hotel and Lodging` - `Matrimony Service` - `Medical and Health` - `Non-profit` - `Online Gambling` - `OTC Drugs` - `Other` - `Physical Gambling` - `Professional Services` - `Public Service` - `Restaurant` - `Shopping and Retail` - `Travel and Transportation`
*/
"vertical"?: string | null;
/**
* The websites of the sender.
*/
"websites"?: Array<MessagingV2ChannelsSenderProfileGenericResponseWebsites> | null;
/**
* The emails of the sender.
*/
"emails"?: Array<MessagingV2ChannelsSenderProfileGenericResponseEmails> | null;
/**
* The phone numbers of the sender.
*/
"phoneNumbers"?: Array<MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers> | null;
constructor(payload: any);
}
export declare class MessagingV2ChannelsSenderProfileGenericResponseEmails {
"email"?: string;
"label"?: string;
constructor(payload: any);
}
export declare class MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers {
"phoneNumber"?: string;
"label"?: string;
constructor(payload: any);
}
export declare class MessagingV2ChannelsSenderProfileGenericResponseWebsites {
"website"?: string;
"label"?: string;
constructor(payload: any);
}
/**
* The additional properties for the sender.
*/
export declare class MessagingV2ChannelsSenderProperties {
/**
* The quality rating of the sender.
*/
"qualityRating"?: string | null;
/**
* The messaging limit of the sender.
*/
"messagingLimit"?: string | null;
constructor(payload: any);
}
export declare class MessagingV2ChannelsSenderRequestsCreate {
/**
* The ID of the sender in `whatsapp:<E.164_PHONE_NUMBER>` format.
*/
"senderId": string | null;
"configuration"?: MessagingV2ChannelsSenderConfiguration | null;
"webhook"?: MessagingV2ChannelsSenderWebhook | null;
"profile"?: MessagingV2ChannelsSenderProfile | null;
constructor(payload: any);
}
export declare class MessagingV2ChannelsSenderRequestsUpdate {
"configuration"?: MessagingV2ChannelsSenderConfiguration | null;
"webhook"?: MessagingV2ChannelsSenderWebhook | null;
"profile"?: MessagingV2ChannelsSenderProfile | null;
constructor(payload: any);
}
/**
* The configuration settings for webhooks.
*/
export declare class MessagingV2ChannelsSenderWebhook {
/**
* The URL to send the webhook to.
*/
"callbackUrl"?: string | null;
/**
* The HTTP method for the webhook.
*/
"callbackMethod"?: string | null;
/**
* The URL to send the fallback webhook to.
*/
"fallbackUrl"?: string | null;
/**
* The HTTP method for the fallback webhook.
*/
"fallbackMethod"?: string | null;
/**
* The URL to send the status callback to.
*/
"statusCallbackUrl"?: string | null;
/**
* The HTTP method for the status callback.
*/
"statusCallbackMethod"?: string | null;
constructor(payload: any);
}
export declare class MessagingV2RcsCarrier {
/**
* The name of the carrier. For example, `Verizon` or `AT&T` for US.
*/
"name"?: string;
"status"?: MessagingV2RcsCarrierStatus;
constructor(payload: any);
}
/**
* The carrier-level status.
*/
export type MessagingV2RcsCarrierStatus = "UNKNOWN" | "UNLAUNCHED" | "CARRIER_REVIEW" | "APPROVED" | "REJECTED" | "SUSPENDED";
export declare class MessagingV2RcsComplianceCountryResponse {
/**
* The ISO 3166-1 alpha-2 country code.
*/
"country": string;
/**
* The default compliance registration SID (e.g., from CR-Google) that applies to all countries unless overridden in the `countries` array.
*/
"registrationSid"?: string;
"status"?: MessagingV2RcsCountryStatus;
"carriers"?: Array<MessagingV2RcsCarrier>;
constructor(payload: any);
}
/**
* The KYC compliance information. This section consists of response to the request launch.
*/
export declare class MessagingV2RcsComplianceResponse {
/**
* The default compliance registration SID (e.g., from CR-Google) that applies to all countries unless overridden in the `countries` array.
*/
"registrationSid": string;
/**
* A list of country-specific compliance details.
*/
"countries"?: Array<MessagingV2RcsComplianceCountryResponse>;
constructor(payload: any);
}
/**
* The country-level status. Based on the aggregation of the carrier-level status.
*/
export type MessagingV2RcsCountryStatus = "ONLINE" | "OFFLINE" | "TWILIO_REVIEW" | "PENDING_VERIFICATION";
/**
* Options to pass to update a ChannelsSenderInstance
*/
export interface ChannelsSenderContextUpdateOptions {
/** */
messagingV2ChannelsSenderRequestsUpdate?: MessagingV2ChannelsSenderRequestsUpdate;
}
/**
* Options to pass to create a ChannelsSenderInstance
*/
export interface ChannelsSenderListInstanceCreateOptions {
/** */
messagingV2ChannelsSenderRequestsCreate: MessagingV2ChannelsSenderRequestsCreate;
}
/**
* Options to pass to each
*/
export interface ChannelsSenderListInstanceEachOptions {
/** */
channel: string;
/** The number of items to return per page. For WhatsApp, the default is `20`. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ChannelsSenderInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ChannelsSenderListInstanceOptions {
/** */
channel: string;
/** The number of items to return per page. For WhatsApp, the default is `20`. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ChannelsSenderListInstancePageOptions {
/** */
channel: string;
/** The number of items to return per page. For WhatsApp, the default is `20`. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ChannelsSenderContext {
/**
* Remove a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
fetch(callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Fetch a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Update a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
update(callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Update a ChannelsSenderInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
update(params: MessagingV2ChannelsSenderRequestsUpdate, headers?: any, callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Update a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Update a ChannelsSenderInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
updateWithHttpInfo(params: MessagingV2ChannelsSenderRequestsUpdate, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ChannelsSenderContextSolution {
sid: string;
}
export declare class ChannelsSenderContextImpl implements ChannelsSenderContext {
protected _version: V2;
protected _solution: ChannelsSenderContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
update(params?: MessagingV2ChannelsSenderRequestsUpdate | ((error: Error | null, item?: ChannelsSenderInstance) => any), headers?: any, callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
updateWithHttpInfo(params?: MessagingV2ChannelsSenderRequestsUpdate | ((error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ChannelsSenderContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ChannelsSenderPayload extends TwilioResponsePayload {
senders: ChannelsSenderResource[];
}
interface ChannelsSenderResource {
sid: string;
status: ChannelsSenderStatus;
sender_id: string;
configuration: MessagingV2ChannelsSenderConfiguration;
webhook: MessagingV2ChannelsSenderWebhook;
profile: MessagingV2ChannelsSenderProfileGenericResponse;
properties: MessagingV2ChannelsSenderProperties;
offline_reasons: Array<MessagingV2ChannelsSenderOfflineReasonsItems>;
compliance: MessagingV2RcsComplianceResponse;
url: string;
}
export declare class ChannelsSenderInstance {
protected _version: V2;
protected _solution: ChannelsSenderContextSolution;
protected _context?: ChannelsSenderContext;
constructor(_version: V2, payload: ChannelsSenderResource, sid?: string);
/**
* The SID of the sender.
*/
sid: string;
status: ChannelsSenderStatus;
/**
* The ID of the sender in `whatsapp:<E.164_PHONE_NUMBER>` format.
*/
senderId: string;
configuration: MessagingV2ChannelsSenderConfiguration;
webhook: MessagingV2ChannelsSenderWebhook;
profile: MessagingV2ChannelsSenderProfileGenericResponse;
properties: MessagingV2ChannelsSenderProperties;
/**
* The reasons why the sender is offline.
*/
offlineReasons: Array<MessagingV2ChannelsSenderOfflineReasonsItems>;
compliance: MessagingV2RcsComplianceResponse;
/**
* The URL of the resource.
*/
url: string;
private get _proxy();
/**
* Remove a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
fetch(callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Fetch a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Update a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
update(callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Update a ChannelsSenderInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
update(params: MessagingV2ChannelsSenderRequestsUpdate, headers?: any, callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Update a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Update a ChannelsSenderInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
updateWithHttpInfo(params: MessagingV2ChannelsSenderRequestsUpdate, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
status: ChannelsSenderStatus;
senderId: string;
configuration: MessagingV2ChannelsSenderConfiguration;
webhook: MessagingV2ChannelsSenderWebhook;
profile: MessagingV2ChannelsSenderProfileGenericResponse;
properties: MessagingV2ChannelsSenderProperties;
offlineReasons: MessagingV2ChannelsSenderOfflineReasonsItems[];
compliance: MessagingV2RcsComplianceResponse;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ChannelsSenderSolution {
}
export interface ChannelsSenderListInstance {
_version: V2;
_solution: ChannelsSenderSolution;
_uri: string;
(sid: string): ChannelsSenderContext;
get(sid: string): ChannelsSenderContext;
/**
* Create a ChannelsSenderInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
create(params: MessagingV2ChannelsSenderRequestsCreate, headers?: any, callback?: (error: Error | null, item?: ChannelsSenderInstance) => any): Promise<ChannelsSenderInstance>;
/**
* Create a ChannelsSenderInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
createWithHttpInfo(params: MessagingV2ChannelsSenderRequestsCreate, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ChannelsSenderInstance>) => any): Promise<ApiResponse<ChannelsSenderInstance>>;
/**
* Streams ChannelsSenderInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelsSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(params: ChannelsSenderListInstanceEachOptions, callback?: (item: ChannelsSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ChannelsSenderInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelsSenderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(params: ChannelsSenderListInstanceEachOptions, callback?: (item: ChannelsSenderInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ChannelsSenderInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ChannelsSenderPage) => any): Promise<ChannelsSenderPage>;
/**
* Retrieve a single target page of ChannelsSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ChannelsSenderPage>) => any): Promise<ApiResponse<ChannelsSenderPage>>;
/**
* Lists ChannelsSenderInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelsSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(params: ChannelsSenderListInstanceOptions, callback?: (error: Error | null, items: ChannelsSenderInstance[]) => any): Promise<ChannelsSenderInstance[]>;
/**
* Lists ChannelsSenderInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelsSenderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(params: ChannelsSenderListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ChannelsSenderInstance[]>) => any): Promise<ApiResponse<ChannelsSenderInstance[]>>;
/**
* Retrieve a single page of ChannelsSenderInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelsSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(params: ChannelsSenderListInstancePageOptions, callback?: (error: Error | null, items: ChannelsSenderPage) => any): Promise<ChannelsSenderPage>;
/**
* Retrieve a single page of ChannelsSenderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ChannelsSenderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(params: ChannelsSenderListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ChannelsSenderPage>) => any): Promise<ApiResponse<ChannelsSenderPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ChannelsSenderListInstance(version: V2): ChannelsSenderListInstance;
export declare class ChannelsSenderPage extends Page<V2, ChannelsSenderPayload, ChannelsSenderResource, ChannelsSenderInstance> {
/**
* Initialize the ChannelsSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: ChannelsSenderSolution);
/**
* Build an instance of ChannelsSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ChannelsSenderResource): ChannelsSenderInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,596 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelsSenderPage = exports.ChannelsSenderInstance = exports.ChannelsSenderContextImpl = exports.MessagingV2RcsComplianceResponse = exports.MessagingV2RcsComplianceCountryResponse = exports.MessagingV2RcsCarrier = exports.MessagingV2ChannelsSenderWebhook = exports.MessagingV2ChannelsSenderRequestsUpdate = exports.MessagingV2ChannelsSenderRequestsCreate = exports.MessagingV2ChannelsSenderProperties = exports.MessagingV2ChannelsSenderProfileGenericResponseWebsites = exports.MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers = exports.MessagingV2ChannelsSenderProfileGenericResponseEmails = exports.MessagingV2ChannelsSenderProfileGenericResponse = exports.MessagingV2ChannelsSenderProfile = exports.MessagingV2ChannelsSenderOfflineReasonsItems = exports.MessagingV2ChannelsSenderConfiguration = void 0;
exports.ChannelsSenderListInstance = ChannelsSenderListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
/**
* The configuration settings for creating a sender.
*/
class MessagingV2ChannelsSenderConfiguration {
constructor(payload) {
this.wabaId = payload["waba_id"];
this.verificationMethod = payload["verification_method"];
this.verificationCode = payload["verification_code"];
this.voiceApplicationSid = payload["voice_application_sid"];
this.accountType = payload["account_type"];
}
}
exports.MessagingV2ChannelsSenderConfiguration = MessagingV2ChannelsSenderConfiguration;
class MessagingV2ChannelsSenderOfflineReasonsItems {
constructor(payload) {
this.code = payload["code"];
this.message = payload["message"];
this.moreInfo = payload["more_info"];
}
}
exports.MessagingV2ChannelsSenderOfflineReasonsItems = MessagingV2ChannelsSenderOfflineReasonsItems;
/**
* The profile information for the sender.
*/
class MessagingV2ChannelsSenderProfile {
constructor(payload) {
this.name = payload["name"];
this.about = payload["about"];
this.address = payload["address"];
this.description = payload["description"];
this.logoUrl = payload["logo_url"];
this.bannerUrl = payload["banner_url"];
this.privacyUrl = payload["privacy_url"];
this.termsOfServiceUrl = payload["terms_of_service_url"];
this.accentColor = payload["accent_color"];
this.vertical = payload["vertical"];
this.websites = payload["websites"];
this.emails = payload["emails"];
this.phoneNumbers = payload["phone_numbers"];
}
}
exports.MessagingV2ChannelsSenderProfile = MessagingV2ChannelsSenderProfile;
/**
* The profile information for the sender.
*/
class MessagingV2ChannelsSenderProfileGenericResponse {
constructor(payload) {
this.name = payload["name"];
this.about = payload["about"];
this.address = payload["address"];
this.description = payload["description"];
this.logoUrl = payload["logo_url"];
this.bannerUrl = payload["banner_url"];
this.privacyUrl = payload["privacy_url"];
this.termsOfServiceUrl = payload["terms_of_service_url"];
this.accentColor = payload["accent_color"];
this.vertical = payload["vertical"];
this.websites = payload["websites"];
this.emails = payload["emails"];
this.phoneNumbers = payload["phone_numbers"];
}
}
exports.MessagingV2ChannelsSenderProfileGenericResponse = MessagingV2ChannelsSenderProfileGenericResponse;
class MessagingV2ChannelsSenderProfileGenericResponseEmails {
constructor(payload) {
this.email = payload["email"];
this.label = payload["label"];
}
}
exports.MessagingV2ChannelsSenderProfileGenericResponseEmails = MessagingV2ChannelsSenderProfileGenericResponseEmails;
class MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers {
constructor(payload) {
this.phoneNumber = payload["phone_number"];
this.label = payload["label"];
}
}
exports.MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers = MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers;
class MessagingV2ChannelsSenderProfileGenericResponseWebsites {
constructor(payload) {
this.website = payload["website"];
this.label = payload["label"];
}
}
exports.MessagingV2ChannelsSenderProfileGenericResponseWebsites = MessagingV2ChannelsSenderProfileGenericResponseWebsites;
/**
* The additional properties for the sender.
*/
class MessagingV2ChannelsSenderProperties {
constructor(payload) {
this.qualityRating = payload["quality_rating"];
this.messagingLimit = payload["messaging_limit"];
}
}
exports.MessagingV2ChannelsSenderProperties = MessagingV2ChannelsSenderProperties;
class MessagingV2ChannelsSenderRequestsCreate {
constructor(payload) {
this.senderId = payload["sender_id"];
this.configuration = payload["configuration"];
this.webhook = payload["webhook"];
this.profile = payload["profile"];
}
}
exports.MessagingV2ChannelsSenderRequestsCreate = MessagingV2ChannelsSenderRequestsCreate;
class MessagingV2ChannelsSenderRequestsUpdate {
constructor(payload) {
this.configuration = payload["configuration"];
this.webhook = payload["webhook"];
this.profile = payload["profile"];
}
}
exports.MessagingV2ChannelsSenderRequestsUpdate = MessagingV2ChannelsSenderRequestsUpdate;
/**
* The configuration settings for webhooks.
*/
class MessagingV2ChannelsSenderWebhook {
constructor(payload) {
this.callbackUrl = payload["callback_url"];
this.callbackMethod = payload["callback_method"];
this.fallbackUrl = payload["fallback_url"];
this.fallbackMethod = payload["fallback_method"];
this.statusCallbackUrl = payload["status_callback_url"];
this.statusCallbackMethod = payload["status_callback_method"];
}
}
exports.MessagingV2ChannelsSenderWebhook = MessagingV2ChannelsSenderWebhook;
class MessagingV2RcsCarrier {
constructor(payload) {
this.name = payload["name"];
this.status = payload["status"];
}
}
exports.MessagingV2RcsCarrier = MessagingV2RcsCarrier;
class MessagingV2RcsComplianceCountryResponse {
constructor(payload) {
this.country = payload["country"];
this.registrationSid = payload["registration_sid"];
this.status = payload["status"];
this.carriers = payload["carriers"];
}
}
exports.MessagingV2RcsComplianceCountryResponse = MessagingV2RcsComplianceCountryResponse;
/**
* The KYC compliance information. This section consists of response to the request launch.
*/
class MessagingV2RcsComplianceResponse {
constructor(payload) {
this.registrationSid = payload["registration_sid"];
this.countries = payload["countries"];
}
}
exports.MessagingV2RcsComplianceResponse = MessagingV2RcsComplianceResponse;
class ChannelsSenderContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Channels/Senders/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelsSenderInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ChannelsSenderInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelsSenderInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ChannelsSenderInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChannelsSenderContextImpl = ChannelsSenderContextImpl;
class ChannelsSenderInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.status = payload.status;
this.senderId = payload.sender_id;
this.configuration =
payload.configuration !== null && payload.configuration !== undefined
? new MessagingV2ChannelsSenderConfiguration(payload.configuration)
: null;
this.webhook =
payload.webhook !== null && payload.webhook !== undefined
? new MessagingV2ChannelsSenderWebhook(payload.webhook)
: null;
this.profile =
payload.profile !== null && payload.profile !== undefined
? new MessagingV2ChannelsSenderProfileGenericResponse(payload.profile)
: null;
this.properties =
payload.properties !== null && payload.properties !== undefined
? new MessagingV2ChannelsSenderProperties(payload.properties)
: null;
this.offlineReasons =
payload.offline_reasons !== null && payload.offline_reasons !== undefined
? payload.offline_reasons.map((payload) => new MessagingV2ChannelsSenderOfflineReasonsItems(payload))
: null;
this.compliance =
payload.compliance !== null && payload.compliance !== undefined
? new MessagingV2RcsComplianceResponse(payload.compliance)
: null;
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ChannelsSenderContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a ChannelsSenderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ChannelsSenderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ChannelsSenderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
status: this.status,
senderId: this.senderId,
configuration: this.configuration,
webhook: this.webhook,
profile: this.profile,
properties: this.properties,
offlineReasons: this.offlineReasons,
compliance: this.compliance,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChannelsSenderInstance = ChannelsSenderInstance;
function ChannelsSenderListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ChannelsSenderContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Channels/Senders`;
instance.create = function create(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelsSenderInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ChannelsSenderInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["channel"] === null || params["channel"] === undefined) {
throw new Error("Required parameter \"params['channel']\" missing.");
}
let data = {};
data["Channel"] = params["channel"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ChannelsSenderPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ChannelsSenderPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["channel"] === null || params["channel"] === undefined) {
throw new Error("Required parameter \"params['channel']\" missing.");
}
let data = {};
data["Channel"] = params["channel"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ChannelsSenderPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ChannelsSenderPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ChannelsSenderPage extends Page_1.default {
/**
* Initialize the ChannelsSenderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ChannelsSenderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ChannelsSenderInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChannelsSenderPage = ChannelsSenderPage;

View File

@@ -0,0 +1,150 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export interface DomainCertsContext {
/**
* Fetch a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
/**
* Fetch a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface DomainCertsContextSolution {
domainSid: string;
}
export declare class DomainCertsContextImpl implements DomainCertsContext {
protected _version: V2;
protected _solution: DomainCertsContextSolution;
protected _uri: string;
constructor(_version: V2, domainSid: string);
fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): DomainCertsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface DomainCertsResource {
domain_sid: string;
date_updated: Date;
date_expires: Date;
date_created: Date;
domain_name: string;
certificate_sid: string;
managed: boolean;
requesting: boolean;
url: string;
cert_in_validation: any;
}
export declare class DomainCertsInstance {
protected _version: V2;
protected _solution: DomainCertsContextSolution;
protected _context?: DomainCertsContext;
constructor(_version: V2, payload: DomainCertsResource, domainSid?: string);
/**
* The unique string that we created to identify the Domain resource.
*/
domainSid: string;
/**
* Date that this Domain was last updated.
*/
dateUpdated: Date;
/**
* Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work.
*/
dateExpires: Date;
/**
* Date that this Domain was registered to the Twilio platform to create a new Domain object.
*/
dateCreated: Date;
/**
* Full url path for this domain.
*/
domainName: string;
/**
* The unique string that we created to identify this Certificate resource.
*/
certificateSid: string;
/**
* Boolean field that indicates whether the certificate is managed by Twilio or uploaded by the customer.
*/
managed: boolean;
/**
* Boolean field that indicates whether a Twilio managed cert request is in progress or completed. True indicates a request is in progress and false indicates the request has completed or not requested yet.
*/
requesting: boolean;
url: string;
/**
* Optional JSON field describing the status and upload date of a new certificate in the process of validation
*/
certInValidation: any;
private get _proxy();
/**
* Fetch a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>;
/**
* Fetch a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DomainCertsInstance>) => any): Promise<ApiResponse<DomainCertsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
domainSid: string;
dateUpdated: Date;
dateExpires: Date;
dateCreated: Date;
domainName: string;
certificateSid: string;
managed: boolean;
requesting: boolean;
url: string;
certInValidation: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface DomainCertsSolution {
}
export interface DomainCertsListInstance {
_version: V2;
_solution: DomainCertsSolution;
_uri: string;
(domainSid: string): DomainCertsContext;
get(domainSid: string): DomainCertsContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DomainCertsListInstance(version: V2): DomainCertsListInstance;
export {};

View File

@@ -0,0 +1,156 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainCertsInstance = exports.DomainCertsContextImpl = void 0;
exports.DomainCertsListInstance = DomainCertsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class DomainCertsContextImpl {
constructor(_version, domainSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(domainSid)) {
throw new Error("Parameter 'domainSid' is not valid.");
}
this._solution = { domainSid };
this._uri = `/LinkShortening/Domains/${domainSid}/Certificate`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new DomainCertsInstance(operationVersion, payload, instance._solution.domainSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new DomainCertsInstance(operationVersion, response.body, instance._solution.domainSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainCertsContextImpl = DomainCertsContextImpl;
class DomainCertsInstance {
constructor(_version, payload, domainSid) {
this._version = _version;
this.domainSid = payload.domain_sid;
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.dateExpires = deserialize.iso8601DateTime(payload.date_expires);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.domainName = payload.domain_name;
this.certificateSid = payload.certificate_sid;
this.managed = payload.managed;
this.requesting = payload.requesting;
this.url = payload.url;
this.certInValidation = payload.cert_in_validation;
this._solution = { domainSid: domainSid || this.domainSid };
}
get _proxy() {
this._context =
this._context ||
new DomainCertsContextImpl(this._version, this._solution.domainSid);
return this._context;
}
/**
* Fetch a DomainCertsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a DomainCertsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed DomainCertsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
domainSid: this.domainSid,
dateUpdated: this.dateUpdated,
dateExpires: this.dateExpires,
dateCreated: this.dateCreated,
domainName: this.domainName,
certificateSid: this.certificateSid,
managed: this.managed,
requesting: this.requesting,
url: this.url,
certInValidation: this.certInValidation,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DomainCertsInstance = DomainCertsInstance;
function DomainCertsListInstance(version) {
const instance = ((domainSid) => instance.get(domainSid));
instance.get = function get(domainSid) {
return new DomainCertsContextImpl(version, domainSid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,64 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to create a TypingIndicatorInstance
*/
export interface TypingIndicatorListInstanceCreateOptions {
/** Shared channel identifier */
channel: string;
/** Message SID that identifies the conversation thread for the typing indicator. Must be a valid Twilio Message SID (SM*) or Media SID (MM*) from an existing WhatsApp conversation. */
messageId: string;
}
export interface TypingIndicatorSolution {
}
export interface TypingIndicatorListInstance {
_version: V2;
_solution: TypingIndicatorSolution;
_uri: string;
/**
* Create a TypingIndicatorInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TypingIndicatorInstance
*/
create(params: TypingIndicatorListInstanceCreateOptions, callback?: (error: Error | null, item?: TypingIndicatorInstance) => any): Promise<TypingIndicatorInstance>;
/**
* Create a TypingIndicatorInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TypingIndicatorInstance with HTTP metadata
*/
createWithHttpInfo(params: TypingIndicatorListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TypingIndicatorInstance>) => any): Promise<ApiResponse<TypingIndicatorInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TypingIndicatorListInstance(version: V2): TypingIndicatorListInstance;
interface TypingIndicatorResource {
success: boolean;
}
export declare class TypingIndicatorInstance {
protected _version: V2;
constructor(_version: V2, payload: TypingIndicatorResource);
/**
* Indicates if the typing indicator was sent successfully.
*/
success: boolean;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
success: boolean;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,111 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Messaging
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypingIndicatorInstance = void 0;
exports.TypingIndicatorListInstance = TypingIndicatorListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function TypingIndicatorListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Indicators/Typing.json`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["channel"] === null || params["channel"] === undefined) {
throw new Error("Required parameter \"params['channel']\" missing.");
}
if (params["messageId"] === null || params["messageId"] === undefined) {
throw new Error("Required parameter \"params['messageId']\" missing.");
}
let data = {};
data["channel"] = params["channel"];
data["messageId"] = params["messageId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new TypingIndicatorInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["channel"] === null || params["channel"] === undefined) {
throw new Error("Required parameter \"params['channel']\" missing.");
}
if (params["messageId"] === null || params["messageId"] === undefined) {
throw new Error("Required parameter \"params['messageId']\" missing.");
}
let data = {};
data["channel"] = params["channel"];
data["messageId"] = params["messageId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new TypingIndicatorInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class TypingIndicatorInstance {
constructor(_version, payload) {
this._version = _version;
this.success = payload.success;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
success: this.success,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TypingIndicatorInstance = TypingIndicatorInstance;