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

25
node_modules/twilio/lib/rest/content/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import ContentBase from "../ContentBase";
import Version from "../../base/Version";
import { ContentListInstance } from "./v1/content";
import { ContentAndApprovalsListInstance } from "./v1/contentAndApprovals";
import { LegacyContentListInstance } from "./v1/legacyContent";
export default class V1 extends Version {
/**
* Initialize the V1 version of Content
*
* @param domain - The Twilio (Twilio.Content) domain
*/
constructor(domain: ContentBase);
/** contents - { Twilio.Content.V1.ContentListInstance } resource */
protected _contents?: ContentListInstance;
/** contentAndApprovals - { Twilio.Content.V1.ContentAndApprovalsListInstance } resource */
protected _contentAndApprovals?: ContentAndApprovalsListInstance;
/** legacyContents - { Twilio.Content.V1.LegacyContentListInstance } resource */
protected _legacyContents?: LegacyContentListInstance;
/** Getter for contents resource */
get contents(): ContentListInstance;
/** Getter for contentAndApprovals resource */
get contentAndApprovals(): ContentAndApprovalsListInstance;
/** Getter for legacyContents resource */
get legacyContents(): LegacyContentListInstance;
}

50
node_modules/twilio/lib/rest/content/V1.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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 content_1 = require("./v1/content");
const contentAndApprovals_1 = require("./v1/contentAndApprovals");
const legacyContent_1 = require("./v1/legacyContent");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Content
*
* @param domain - The Twilio (Twilio.Content) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for contents resource */
get contents() {
this._contents = this._contents || (0, content_1.ContentListInstance)(this);
return this._contents;
}
/** Getter for contentAndApprovals resource */
get contentAndApprovals() {
this._contentAndApprovals =
this._contentAndApprovals || (0, contentAndApprovals_1.ContentAndApprovalsListInstance)(this);
return this._contentAndApprovals;
}
/** Getter for legacyContents resource */
get legacyContents() {
this._legacyContents =
this._legacyContents || (0, legacyContent_1.LegacyContentListInstance)(this);
return this._legacyContents;
}
}
exports.default = V1;

20
node_modules/twilio/lib/rest/content/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import ContentBase from "../ContentBase";
import Version from "../../base/Version";
import { ContentListInstance } from "./v2/content";
import { ContentAndApprovalsListInstance } from "./v2/contentAndApprovals";
export default class V2 extends Version {
/**
* Initialize the V2 version of Content
*
* @param domain - The Twilio (Twilio.Content) domain
*/
constructor(domain: ContentBase);
/** contents - { Twilio.Content.V2.ContentListInstance } resource */
protected _contents?: ContentListInstance;
/** contentAndApprovals - { Twilio.Content.V2.ContentAndApprovalsListInstance } resource */
protected _contentAndApprovals?: ContentAndApprovalsListInstance;
/** Getter for contents resource */
get contents(): ContentListInstance;
/** Getter for contentAndApprovals resource */
get contentAndApprovals(): ContentAndApprovalsListInstance;
}

43
node_modules/twilio/lib/rest/content/V2.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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 content_1 = require("./v2/content");
const contentAndApprovals_1 = require("./v2/contentAndApprovals");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Content
*
* @param domain - The Twilio (Twilio.Content) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Getter for contents resource */
get contents() {
this._contents = this._contents || (0, content_1.ContentListInstance)(this);
return this._contents;
}
/** Getter for contentAndApprovals resource */
get contentAndApprovals() {
this._contentAndApprovals =
this._contentAndApprovals || (0, contentAndApprovals_1.ContentAndApprovalsListInstance)(this);
return this._contentAndApprovals;
}
}
exports.default = V2;

713
node_modules/twilio/lib/rest/content/v1/content.d.ts generated vendored Normal file
View File

@@ -0,0 +1,713 @@
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 { ApprovalCreateListInstance } from "./content/approvalCreate";
import { ApprovalFetchListInstance } from "./content/approvalFetch";
export declare class AuthenticationAction {
"type": AuthenticationActionType;
"copyCodeText": string;
constructor(payload: any);
}
export type AuthenticationActionType = "COPY_CODE";
export declare class CallToActionAction {
"type": CallToActionActionType;
"title": string;
"url"?: string;
"phone"?: string;
"code"?: string;
"id"?: string;
constructor(payload: any);
}
export type CallToActionActionType = "URL" | "PHONE_NUMBER" | "COPY_CODE" | "VOICE_CALL" | "VOICE_CALL_REQUEST";
export declare class CardAction {
"type": CardActionType;
"title": string;
"url"?: string;
"phone"?: string;
"id"?: string;
"code"?: string;
"webviewSize"?: WebviewSizeType;
constructor(payload: any);
}
export type CardActionType = "URL" | "PHONE_NUMBER" | "QUICK_REPLY" | "COPY_CODE" | "VOICE_CALL";
export declare class CarouselAction {
"type": CarouselActionType;
"title": string;
"url"?: string;
"phone"?: string;
"id"?: string;
constructor(payload: any);
}
export type CarouselActionType = "URL" | "PHONE_NUMBER" | "QUICK_REPLY";
export declare class CarouselCard {
"title"?: string;
"body": string;
"media": string;
"actions": Array<CarouselAction>;
constructor(payload: any);
}
export declare class CatalogItem {
"id"?: string;
"sectionTitle"?: string;
"name"?: string;
"mediaUrl"?: string;
"price"?: number;
"description"?: string;
constructor(payload: any);
}
/**
* Content creation request body
*/
export declare class ContentCreateRequest {
/**
* User defined name of the content
*/
"friendlyName"?: string;
/**
* Key value pairs of variable name to value
*/
"variables"?: {
[key: string]: string;
};
/**
* Language code for the content
*/
"language": string;
"types": Types;
constructor(payload: any);
}
/**
* Content update request body
*/
export declare class ContentUpdateRequest {
/**
* User defined name of the content
*/
"friendlyName"?: string;
/**
* Key value pairs of variable name to value
*/
"variables"?: {
[key: string]: string;
};
/**
* Language code for the content
*/
"language"?: string;
"types": Types;
constructor(payload: any);
}
export declare class FlowsPage {
"id": string;
"nextPageId"?: string;
"title": string;
"subtitle"?: string;
"layout": Array<FlowsPageComponent>;
constructor(payload: any);
}
export declare class FlowsPageComponent {
"label"?: string;
"type": string;
constructor(payload: any);
}
export declare class ListItem {
"id": string;
"item": string;
"description"?: string;
constructor(payload: any);
}
export declare class QuickReplyAction {
"type"?: QuickReplyActionType;
"title": string;
"id"?: string;
constructor(payload: any);
}
export type QuickReplyActionType = "QUICK_REPLY";
/**
* twilio/call-to-action buttons let recipients tap to trigger actions such as launching a website or making a phone call.
*/
export declare class TwilioCallToAction {
"body": string;
"actions": Array<CallToActionAction>;
constructor(payload: any);
}
/**
* twilio/card is a structured template which can be used to send a series of related information. It must include a title and at least one additional field.
*/
export declare class TwilioCard {
"title"?: string;
"subtitle"?: string;
"media"?: Array<string>;
"actions"?: Array<CardAction>;
constructor(payload: any);
}
/**
* twilio/carousel templates allow you to send a single text message accompanied by a set of up to 10 carousel cards in a horizontally scrollable view
*/
export declare class TwilioCarousel {
"body": string;
"cards": Array<CarouselCard>;
constructor(payload: any);
}
/**
* twilio/catalog type lets recipients view list of catalog products, ask questions about products, order products.
*/
export declare class TwilioCatalog {
"title"?: string;
"body": string;
"subtitle"?: string;
"id"?: string;
"items"?: Array<CatalogItem>;
"dynamicItems"?: string;
constructor(payload: any);
}
/**
* twilio/flows templates allow you to send multiple messages in a set order with text or select options
*/
export declare class TwilioFlows {
"body": string;
"buttonText": string;
"subtitle"?: string;
"mediaUrl"?: string;
"pages": Array<FlowsPage>;
"type": string;
constructor(payload: any);
}
/**
* twilio/list-picker includes a menu of up to 10 options, which offers a simple way for users to make a selection.
*/
export declare class TwilioListPicker {
"body": string;
"button": string;
"items": Array<ListItem>;
constructor(payload: any);
}
/**
* twilio/location type contains a location pin and an optional label, which can be used to enhance delivery notifications or connect recipients to physical experiences you offer.
*/
export declare class TwilioLocation {
"latitude": number;
"longitude": number;
"label"?: string;
"id"?: string;
"address"?: string;
constructor(payload: any);
}
/**
* twilio/media is used to send file attachments, or to send long text via MMS in the US and Canada. As such, the twilio/media type must contain at least ONE of text or media content.
*/
export declare class TwilioMedia {
"body"?: string;
"media": Array<string>;
constructor(payload: any);
}
/**
* twilio/quick-reply templates let recipients tap, rather than type, to respond to the message.
*/
export declare class TwilioQuickReply {
"body": string;
"actions": Array<QuickReplyAction>;
constructor(payload: any);
}
/**
* twilio/schedule templates allow us to send a message with a schedule with different time slots
*/
export declare class TwilioSchedule {
"id": string;
"title": string;
"timeSlots": string;
constructor(payload: any);
}
/**
* Type containing only plain text-based content
*/
export declare class TwilioText {
"body": string;
constructor(payload: any);
}
/**
* Content types
*/
export declare class Types {
"twilioText"?: TwilioText | null;
"twilioMedia"?: TwilioMedia | null;
"twilioLocation"?: TwilioLocation | null;
"twilioListPicker"?: TwilioListPicker | null;
"twilioCallToAction"?: TwilioCallToAction | null;
"twilioQuickReply"?: TwilioQuickReply | null;
"twilioCard"?: TwilioCard | null;
"twilioCatalog"?: TwilioCatalog | null;
"twilioCarousel"?: TwilioCarousel | null;
"twilioFlows"?: TwilioFlows | null;
"twilioSchedule"?: TwilioSchedule | null;
"whatsappCard"?: WhatsappCard | null;
"whatsappAuthentication"?: WhatsappAuthentication | null;
"whatsappFlows"?: WhatsappFlows | null;
constructor(payload: any);
}
export type WebviewSizeType = "TALL" | "FULL" | "HALF" | "NONE";
/**
* whatsApp/authentication templates let companies deliver WA approved one-time-password button.
*/
export declare class WhatsappAuthentication {
"addSecurityRecommendation"?: boolean;
"codeExpirationMinutes"?: number;
"actions": Array<AuthenticationAction>;
constructor(payload: any);
}
/**
* whatsapp/card is a structured template which can be used to send a series of related information. It must include a body and at least one additional field.
*/
export declare class WhatsappCard {
"body": string;
"footer"?: string;
"media"?: Array<string>;
"headerText"?: string;
"actions"?: Array<CardAction>;
constructor(payload: any);
}
/**
* whatsapp/flows templates allow you to send multiple messages in a set order with text or select options
*/
export declare class WhatsappFlows {
"body": string;
"buttonText": string;
"subtitle"?: string;
"mediaUrl"?: string;
"flowId": string;
"flowToken"?: string;
"flowFirstPageId"?: string;
"isFlowFirstPageEndpoint"?: boolean;
constructor(payload: any);
}
/**
* Options to pass to update a ContentInstance
*/
export interface ContentContextUpdateOptions {
/** */
contentUpdateRequest: ContentUpdateRequest;
}
/**
* Options to pass to create a ContentInstance
*/
export interface ContentListInstanceCreateOptions {
/** */
contentCreateRequest: ContentCreateRequest;
}
/**
* Options to pass to each
*/
export interface ContentListInstanceEachOptions {
/** 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: ContentInstance, 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 ContentListInstanceOptions {
/** 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 ContentListInstancePageOptions {
/** 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 ContentContext {
approvalCreate: ApprovalCreateListInstance;
approvalFetch: ApprovalFetchListInstance;
/**
* Remove a ContentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ContentInstance 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 ContentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance
*/
fetch(callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>;
/**
* Fetch a ContentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
/**
* Update a ContentInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance
*/
update(params: ContentUpdateRequest, headers?: any, callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>;
/**
* Update a ContentInstance 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 ContentInstance with HTTP metadata
*/
updateWithHttpInfo(params: ContentUpdateRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ContentContextSolution {
sid: string;
}
export declare class ContentContextImpl implements ContentContext {
protected _version: V1;
protected _solution: ContentContextSolution;
protected _uri: string;
protected _approvalCreate?: ApprovalCreateListInstance;
protected _approvalFetch?: ApprovalFetchListInstance;
constructor(_version: V1, sid: string);
get approvalCreate(): ApprovalCreateListInstance;
get approvalFetch(): ApprovalFetchListInstance;
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?: ContentInstance) => any): Promise<ContentInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
update(params: ContentUpdateRequest, headers?: any, callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>;
updateWithHttpInfo(params: ContentUpdateRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ContentContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ContentPayload extends TwilioResponsePayload {
contents: ContentResource[];
}
interface ContentResource {
date_created: Date;
date_updated: Date;
sid: string;
account_sid: string;
friendly_name: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
url: string;
links: Record<string, string>;
}
export declare class ContentInstance {
protected _version: V1;
protected _solution: ContentContextSolution;
protected _context?: ContentContext;
constructor(_version: V1, payload: ContentResource, sid?: string);
/**
* The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The unique string that that we created to identify the Content resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
*/
accountSid: string;
/**
* A string name used to describe the Content resource. Not visible to the end recipient.
*/
friendlyName: string;
/**
* Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
*/
language: string;
/**
* Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
*/
variables: Record<string, object>;
/**
* The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource.
*/
types: Record<string, object>;
/**
* The URL of the resource, relative to `https://content.twilio.com`.
*/
url: string;
/**
* A list of links related to the Content resource, such as approval_fetch and approval_create
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a ContentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ContentInstance 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 ContentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance
*/
fetch(callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>;
/**
* Fetch a ContentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
/**
* Update a ContentInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance
*/
update(params: ContentUpdateRequest, headers?: any, callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>;
/**
* Update a ContentInstance 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 ContentInstance with HTTP metadata
*/
updateWithHttpInfo(params: ContentUpdateRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
/**
* Access the approvalCreate.
*/
approvalCreate(): ApprovalCreateListInstance;
/**
* Access the approvalFetch.
*/
approvalFetch(): ApprovalFetchListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
dateCreated: Date;
dateUpdated: Date;
sid: string;
accountSid: string;
friendlyName: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ContentSolution {
}
export interface ContentListInstance {
_version: V1;
_solution: ContentSolution;
_uri: string;
(sid: string): ContentContext;
get(sid: string): ContentContext;
/**
* Create a ContentInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance
*/
create(params: ContentCreateRequest, headers?: any, callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>;
/**
* Create a ContentInstance 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 ContentInstance with HTTP metadata
*/
createWithHttpInfo(params: ContentCreateRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ContentInstance>) => any): Promise<ApiResponse<ContentInstance>>;
/**
* Streams ContentInstance 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 { ContentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
each(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ContentInstance 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 { ContentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ContentInstance 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: ContentPage) => any): Promise<ContentPage>;
/**
* Retrieve a single target page of ContentInstance 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<ContentPage>) => any): Promise<ApiResponse<ContentPage>>;
/**
* Lists ContentInstance 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 { ContentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
list(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
/**
* Lists ContentInstance 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 { ContentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentInstance[]>) => any): Promise<ApiResponse<ContentInstance[]>>;
listWithHttpInfo(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ContentInstance[]>) => any): Promise<ApiResponse<ContentInstance[]>>;
/**
* Retrieve a single page of ContentInstance 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 { ContentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
page(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
/**
* Retrieve a single page of ContentInstance 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 { ContentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentPage>) => any): Promise<ApiResponse<ContentPage>>;
pageWithHttpInfo(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ContentPage>) => any): Promise<ApiResponse<ContentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ContentListInstance(version: V1): ContentListInstance;
export declare class ContentPage extends Page<V1, ContentPayload, ContentResource, ContentInstance> {
/**
* Initialize the ContentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ContentSolution);
/**
* Build an instance of ContentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ContentResource): ContentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

748
node_modules/twilio/lib/rest/content/v1/content.js generated vendored Normal file
View File

@@ -0,0 +1,748 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.ContentPage = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappFlows = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioSchedule = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioFlows = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.FlowsPageComponent = exports.FlowsPage = exports.ContentUpdateRequest = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
exports.ContentListInstance = ContentListInstance;
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 approvalCreate_1 = require("./content/approvalCreate");
const approvalFetch_1 = require("./content/approvalFetch");
class AuthenticationAction {
constructor(payload) {
this.type = payload["type"];
this.copyCodeText = payload["copy_code_text"];
}
}
exports.AuthenticationAction = AuthenticationAction;
class CallToActionAction {
constructor(payload) {
this.type = payload["type"];
this.title = payload["title"];
this.url = payload["url"];
this.phone = payload["phone"];
this.code = payload["code"];
this.id = payload["id"];
}
}
exports.CallToActionAction = CallToActionAction;
class CardAction {
constructor(payload) {
this.type = payload["type"];
this.title = payload["title"];
this.url = payload["url"];
this.phone = payload["phone"];
this.id = payload["id"];
this.code = payload["code"];
this.webviewSize = payload["webview_size"];
}
}
exports.CardAction = CardAction;
class CarouselAction {
constructor(payload) {
this.type = payload["type"];
this.title = payload["title"];
this.url = payload["url"];
this.phone = payload["phone"];
this.id = payload["id"];
}
}
exports.CarouselAction = CarouselAction;
class CarouselCard {
constructor(payload) {
this.title = payload["title"];
this.body = payload["body"];
this.media = payload["media"];
this.actions = payload["actions"];
}
}
exports.CarouselCard = CarouselCard;
class CatalogItem {
constructor(payload) {
this.id = payload["id"];
this.sectionTitle = payload["section_title"];
this.name = payload["name"];
this.mediaUrl = payload["media_url"];
this.price = payload["price"];
this.description = payload["description"];
}
}
exports.CatalogItem = CatalogItem;
/**
* Content creation request body
*/
class ContentCreateRequest {
constructor(payload) {
this.friendlyName = payload["friendly_name"];
this.variables = payload["variables"];
this.language = payload["language"];
this.types = payload["types"];
}
}
exports.ContentCreateRequest = ContentCreateRequest;
/**
* Content update request body
*/
class ContentUpdateRequest {
constructor(payload) {
this.friendlyName = payload["friendly_name"];
this.variables = payload["variables"];
this.language = payload["language"];
this.types = payload["types"];
}
}
exports.ContentUpdateRequest = ContentUpdateRequest;
class FlowsPage {
constructor(payload) {
this.id = payload["id"];
this.nextPageId = payload["next_page_id"];
this.title = payload["title"];
this.subtitle = payload["subtitle"];
this.layout = payload["layout"];
}
}
exports.FlowsPage = FlowsPage;
class FlowsPageComponent {
constructor(payload) {
this.label = payload["label"];
this.type = payload["type"];
}
}
exports.FlowsPageComponent = FlowsPageComponent;
class ListItem {
constructor(payload) {
this.id = payload["id"];
this.item = payload["item"];
this.description = payload["description"];
}
}
exports.ListItem = ListItem;
class QuickReplyAction {
constructor(payload) {
this.type = payload["type"];
this.title = payload["title"];
this.id = payload["id"];
}
}
exports.QuickReplyAction = QuickReplyAction;
/**
* twilio/call-to-action buttons let recipients tap to trigger actions such as launching a website or making a phone call.
*/
class TwilioCallToAction {
constructor(payload) {
this.body = payload["body"];
this.actions = payload["actions"];
}
}
exports.TwilioCallToAction = TwilioCallToAction;
/**
* twilio/card is a structured template which can be used to send a series of related information. It must include a title and at least one additional field.
*/
class TwilioCard {
constructor(payload) {
this.title = payload["title"];
this.subtitle = payload["subtitle"];
this.media = payload["media"];
this.actions = payload["actions"];
}
}
exports.TwilioCard = TwilioCard;
/**
* twilio/carousel templates allow you to send a single text message accompanied by a set of up to 10 carousel cards in a horizontally scrollable view
*/
class TwilioCarousel {
constructor(payload) {
this.body = payload["body"];
this.cards = payload["cards"];
}
}
exports.TwilioCarousel = TwilioCarousel;
/**
* twilio/catalog type lets recipients view list of catalog products, ask questions about products, order products.
*/
class TwilioCatalog {
constructor(payload) {
this.title = payload["title"];
this.body = payload["body"];
this.subtitle = payload["subtitle"];
this.id = payload["id"];
this.items = payload["items"];
this.dynamicItems = payload["dynamic_items"];
}
}
exports.TwilioCatalog = TwilioCatalog;
/**
* twilio/flows templates allow you to send multiple messages in a set order with text or select options
*/
class TwilioFlows {
constructor(payload) {
this.body = payload["body"];
this.buttonText = payload["button_text"];
this.subtitle = payload["subtitle"];
this.mediaUrl = payload["media_url"];
this.pages = payload["pages"];
this.type = payload["type"];
}
}
exports.TwilioFlows = TwilioFlows;
/**
* twilio/list-picker includes a menu of up to 10 options, which offers a simple way for users to make a selection.
*/
class TwilioListPicker {
constructor(payload) {
this.body = payload["body"];
this.button = payload["button"];
this.items = payload["items"];
}
}
exports.TwilioListPicker = TwilioListPicker;
/**
* twilio/location type contains a location pin and an optional label, which can be used to enhance delivery notifications or connect recipients to physical experiences you offer.
*/
class TwilioLocation {
constructor(payload) {
this.latitude = payload["latitude"];
this.longitude = payload["longitude"];
this.label = payload["label"];
this.id = payload["id"];
this.address = payload["address"];
}
}
exports.TwilioLocation = TwilioLocation;
/**
* twilio/media is used to send file attachments, or to send long text via MMS in the US and Canada. As such, the twilio/media type must contain at least ONE of text or media content.
*/
class TwilioMedia {
constructor(payload) {
this.body = payload["body"];
this.media = payload["media"];
}
}
exports.TwilioMedia = TwilioMedia;
/**
* twilio/quick-reply templates let recipients tap, rather than type, to respond to the message.
*/
class TwilioQuickReply {
constructor(payload) {
this.body = payload["body"];
this.actions = payload["actions"];
}
}
exports.TwilioQuickReply = TwilioQuickReply;
/**
* twilio/schedule templates allow us to send a message with a schedule with different time slots
*/
class TwilioSchedule {
constructor(payload) {
this.id = payload["id"];
this.title = payload["title"];
this.timeSlots = payload["timeSlots"];
}
}
exports.TwilioSchedule = TwilioSchedule;
/**
* Type containing only plain text-based content
*/
class TwilioText {
constructor(payload) {
this.body = payload["body"];
}
}
exports.TwilioText = TwilioText;
/**
* Content types
*/
class Types {
constructor(payload) {
this.twilioText = payload["twilio/text"];
this.twilioMedia = payload["twilio/media"];
this.twilioLocation = payload["twilio/location"];
this.twilioListPicker = payload["twilio/list-picker"];
this.twilioCallToAction = payload["twilio/call-to-action"];
this.twilioQuickReply = payload["twilio/quick-reply"];
this.twilioCard = payload["twilio/card"];
this.twilioCatalog = payload["twilio/catalog"];
this.twilioCarousel = payload["twilio/carousel"];
this.twilioFlows = payload["twilio/flows"];
this.twilioSchedule = payload["twilio/schedule"];
this.whatsappCard = payload["whatsapp/card"];
this.whatsappAuthentication = payload["whatsapp/authentication"];
this.whatsappFlows = payload["whatsapp/flows"];
}
}
exports.Types = Types;
/**
* whatsApp/authentication templates let companies deliver WA approved one-time-password button.
*/
class WhatsappAuthentication {
constructor(payload) {
this.addSecurityRecommendation = payload["add_security_recommendation"];
this.codeExpirationMinutes = payload["code_expiration_minutes"];
this.actions = payload["actions"];
}
}
exports.WhatsappAuthentication = WhatsappAuthentication;
/**
* whatsapp/card is a structured template which can be used to send a series of related information. It must include a body and at least one additional field.
*/
class WhatsappCard {
constructor(payload) {
this.body = payload["body"];
this.footer = payload["footer"];
this.media = payload["media"];
this.headerText = payload["header_text"];
this.actions = payload["actions"];
}
}
exports.WhatsappCard = WhatsappCard;
/**
* whatsapp/flows templates allow you to send multiple messages in a set order with text or select options
*/
class WhatsappFlows {
constructor(payload) {
this.body = payload["body"];
this.buttonText = payload["button_text"];
this.subtitle = payload["subtitle"];
this.mediaUrl = payload["media_url"];
this.flowId = payload["flow_id"];
this.flowToken = payload["flow_token"];
this.flowFirstPageId = payload["flow_first_page_id"];
this.isFlowFirstPageEndpoint = payload["is_flow_first_page_endpoint"];
}
}
exports.WhatsappFlows = WhatsappFlows;
class ContentContextImpl {
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 = `/Content/${sid}`;
}
get approvalCreate() {
this._approvalCreate =
this._approvalCreate ||
(0, approvalCreate_1.ApprovalCreateListInstance)(this._version, this._solution.sid);
return this._approvalCreate;
}
get approvalFetch() {
this._approvalFetch =
this._approvalFetch ||
(0, approvalFetch_1.ApprovalFetchListInstance)(this._version, this._solution.sid);
return this._approvalFetch;
}
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 ContentInstance(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 ContentInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(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";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "put",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ContentInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(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";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "put",
data,
headers,
})
.then((response) => ({
...response,
body: new ContentInstance(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.ContentContextImpl = ContentContextImpl;
class ContentInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.language = payload.language;
this.variables = payload.variables;
this.types = payload.types;
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ContentContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a ContentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ContentInstance 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 ContentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ContentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ContentInstance 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 approvalCreate.
*/
approvalCreate() {
return this._proxy.approvalCreate;
}
/**
* Access the approvalFetch.
*/
approvalFetch() {
return this._proxy.approvalFetch;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
language: this.language,
variables: this.variables,
types: this.types,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentInstance = ContentInstance;
function ContentListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ContentContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Content`;
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 ContentInstance(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 ContentInstance(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 ContentPage(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 ContentPage(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 ContentPage(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 ContentPage(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 ContentPage extends Page_1.default {
/**
* Initialize the ContentPage
*
* @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 ContentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ContentInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentPage = ContentPage;

View File

@@ -0,0 +1,91 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Content approval request body
*/
export declare class ContentApprovalRequest {
/**
* Name of the template.
*/
"name": string;
/**
* A WhatsApp recognized template category.
*/
"category": string;
constructor(payload: any);
}
/**
* Options to pass to create a ApprovalCreateInstance
*/
export interface ApprovalCreateListInstanceCreateOptions {
/** */
contentApprovalRequest: ContentApprovalRequest;
}
export interface ApprovalCreateSolution {
contentSid: string;
}
export interface ApprovalCreateListInstance {
_version: V1;
_solution: ApprovalCreateSolution;
_uri: string;
/**
* Create a ApprovalCreateInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalCreateInstance
*/
create(params: ContentApprovalRequest, headers?: any, callback?: (error: Error | null, item?: ApprovalCreateInstance) => any): Promise<ApprovalCreateInstance>;
/**
* Create a ApprovalCreateInstance 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 ApprovalCreateInstance with HTTP metadata
*/
createWithHttpInfo(params: ContentApprovalRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ApprovalCreateInstance>) => any): Promise<ApiResponse<ApprovalCreateInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ApprovalCreateListInstance(version: V1, contentSid: string): ApprovalCreateListInstance;
interface ApprovalCreateResource {
name: string;
category: string;
content_type: string;
status: string;
rejection_reason: string;
allow_category_change: boolean;
}
export declare class ApprovalCreateInstance {
protected _version: V1;
constructor(_version: V1, payload: ApprovalCreateResource, contentSid: string);
name: string;
category: string;
contentType: string;
status: string;
rejectionReason: string;
allowCategoryChange: boolean;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
name: string;
category: string;
contentType: string;
status: string;
rejectionReason: string;
allowCategoryChange: boolean;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,125 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.ApprovalCreateInstance = exports.ContentApprovalRequest = void 0;
exports.ApprovalCreateListInstance = ApprovalCreateListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
/**
* Content approval request body
*/
class ContentApprovalRequest {
constructor(payload) {
this.name = payload["name"];
this.category = payload["category"];
}
}
exports.ContentApprovalRequest = ContentApprovalRequest;
function ApprovalCreateListInstance(version, contentSid) {
if (!(0, utility_1.isValidPathParam)(contentSid)) {
throw new Error("Parameter 'contentSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { contentSid };
instance._uri = `/Content/${contentSid}/ApprovalRequests/whatsapp`;
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 ApprovalCreateInstance(operationVersion, payload, instance._solution.contentSid));
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 ApprovalCreateInstance(operationVersion, response.body, instance._solution.contentSid),
}));
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 ApprovalCreateInstance {
constructor(_version, payload, contentSid) {
this._version = _version;
this.name = payload.name;
this.category = payload.category;
this.contentType = payload.content_type;
this.status = payload.status;
this.rejectionReason = payload.rejection_reason;
this.allowCategoryChange = payload.allow_category_change;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
name: this.name,
category: this.category,
contentType: this.contentType,
status: this.status,
rejectionReason: this.rejectionReason,
allowCategoryChange: this.allowCategoryChange,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ApprovalCreateInstance = ApprovalCreateInstance;

View File

@@ -0,0 +1,118 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export interface ApprovalFetchContext {
/**
* Fetch a ApprovalFetchInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalFetchInstance
*/
fetch(callback?: (error: Error | null, item?: ApprovalFetchInstance) => any): Promise<ApprovalFetchInstance>;
/**
* Fetch a ApprovalFetchInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalFetchInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ApprovalFetchInstance>) => any): Promise<ApiResponse<ApprovalFetchInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ApprovalFetchContextSolution {
sid: string;
}
export declare class ApprovalFetchContextImpl implements ApprovalFetchContext {
protected _version: V1;
protected _solution: ApprovalFetchContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: ApprovalFetchInstance) => any): Promise<ApprovalFetchInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ApprovalFetchInstance>) => any): Promise<ApiResponse<ApprovalFetchInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ApprovalFetchContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ApprovalFetchResource {
sid: string;
account_sid: string;
whatsapp: Record<string, object>;
url: string;
}
export declare class ApprovalFetchInstance {
protected _version: V1;
protected _solution: ApprovalFetchContextSolution;
protected _context?: ApprovalFetchContext;
constructor(_version: V1, payload: ApprovalFetchResource, sid: string);
/**
* The unique string that that we created to identify the Content resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
*/
accountSid: string;
/**
* Contains the whatsapp approval information for the Content resource, with fields such as approval status, rejection reason, and category, amongst others.
*/
whatsapp: Record<string, object>;
/**
* The URL of the resource, relative to `https://content.twilio.com`.
*/
url: string;
private get _proxy();
/**
* Fetch a ApprovalFetchInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalFetchInstance
*/
fetch(callback?: (error: Error | null, item?: ApprovalFetchInstance) => any): Promise<ApprovalFetchInstance>;
/**
* Fetch a ApprovalFetchInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalFetchInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ApprovalFetchInstance>) => any): Promise<ApiResponse<ApprovalFetchInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
whatsapp: Record<string, object>;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ApprovalFetchSolution {
sid: string;
}
export interface ApprovalFetchListInstance {
_version: V1;
_solution: ApprovalFetchSolution;
_uri: string;
(): ApprovalFetchContext;
get(): ApprovalFetchContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ApprovalFetchListInstance(version: V1, sid: string): ApprovalFetchListInstance;
export {};

View File

@@ -0,0 +1,147 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.ApprovalFetchInstance = exports.ApprovalFetchContextImpl = void 0;
exports.ApprovalFetchListInstance = ApprovalFetchListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class ApprovalFetchContextImpl {
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 = `/Content/${sid}/ApprovalRequests`;
}
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 ApprovalFetchInstance(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 ApprovalFetchInstance(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.ApprovalFetchContextImpl = ApprovalFetchContextImpl;
class ApprovalFetchInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.whatsapp = payload.whatsapp;
this.url = payload.url;
this._solution = { sid };
}
get _proxy() {
this._context =
this._context ||
new ApprovalFetchContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a ApprovalFetchInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalFetchInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ApprovalFetchInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ApprovalFetchInstance 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,
whatsapp: this.whatsapp,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ApprovalFetchInstance = ApprovalFetchInstance;
function ApprovalFetchListInstance(version, sid) {
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new ApprovalFetchContextImpl(version, sid);
};
instance._version = version;
instance._solution = { sid };
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,242 @@
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 each
*/
export interface ContentAndApprovalsListInstanceEachOptions {
/** 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: ContentAndApprovalsInstance, 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 ContentAndApprovalsListInstanceOptions {
/** 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 ContentAndApprovalsListInstancePageOptions {
/** 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 ContentAndApprovalsSolution {
}
export interface ContentAndApprovalsListInstance {
_version: V1;
_solution: ContentAndApprovalsSolution;
_uri: string;
/**
* Streams ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
each(params: ContentAndApprovalsListInstanceEachOptions, callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ContentAndApprovalsListInstanceEachOptions, callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ContentAndApprovalsInstance 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: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>;
/**
* Retrieve a single target page of ContentAndApprovalsInstance 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<ContentAndApprovalsPage>) => any): Promise<ApiResponse<ContentAndApprovalsPage>>;
/**
* Lists ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>;
list(params: ContentAndApprovalsListInstanceOptions, callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>;
/**
* Lists ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsInstance[]>) => any): Promise<ApiResponse<ContentAndApprovalsInstance[]>>;
listWithHttpInfo(params: ContentAndApprovalsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsInstance[]>) => any): Promise<ApiResponse<ContentAndApprovalsInstance[]>>;
/**
* Retrieve a single page of ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>;
page(params: ContentAndApprovalsListInstancePageOptions, callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>;
/**
* Retrieve a single page of ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsPage>) => any): Promise<ApiResponse<ContentAndApprovalsPage>>;
pageWithHttpInfo(params: ContentAndApprovalsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsPage>) => any): Promise<ApiResponse<ContentAndApprovalsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ContentAndApprovalsListInstance(version: V1): ContentAndApprovalsListInstance;
interface ContentAndApprovalsPayload extends TwilioResponsePayload {
contents: ContentAndApprovalsResource[];
}
interface ContentAndApprovalsResource {
date_created: Date;
date_updated: Date;
sid: string;
account_sid: string;
friendly_name: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
approval_requests: Record<string, object>;
}
export declare class ContentAndApprovalsInstance {
protected _version: V1;
constructor(_version: V1, payload: ContentAndApprovalsResource);
/**
* The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The unique string that that we created to identify the Content resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
*/
accountSid: string;
/**
* A string name used to describe the Content resource. Not visible to the end recipient.
*/
friendlyName: string;
/**
* Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
*/
language: string;
/**
* Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
*/
variables: Record<string, object>;
/**
* The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource.
*/
types: Record<string, object>;
/**
* The submitted information and approval request status of the Content resource.
*/
approvalRequests: Record<string, object>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
dateCreated: Date;
dateUpdated: Date;
sid: string;
accountSid: string;
friendlyName: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
approvalRequests: Record<string, object>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class ContentAndApprovalsPage extends Page<V1, ContentAndApprovalsPayload, ContentAndApprovalsResource, ContentAndApprovalsInstance> {
/**
* Initialize the ContentAndApprovalsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ContentAndApprovalsSolution);
/**
* Build an instance of ContentAndApprovalsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ContentAndApprovalsResource): ContentAndApprovalsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,183 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.ContentAndApprovalsPage = exports.ContentAndApprovalsInstance = void 0;
exports.ContentAndApprovalsListInstance = ContentAndApprovalsListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function ContentAndApprovalsListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/ContentAndApprovals`;
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 ContentAndApprovalsPage(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 ContentAndApprovalsPage(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 ContentAndApprovalsPage(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 ContentAndApprovalsPage(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 ContentAndApprovalsInstance {
constructor(_version, payload) {
this._version = _version;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.language = payload.language;
this.variables = payload.variables;
this.types = payload.types;
this.approvalRequests = payload.approval_requests;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
language: this.language,
variables: this.variables,
types: this.types,
approvalRequests: this.approvalRequests,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentAndApprovalsInstance = ContentAndApprovalsInstance;
class ContentAndApprovalsPage extends Page_1.default {
/**
* Initialize the ContentAndApprovalsPage
*
* @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 ContentAndApprovalsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ContentAndApprovalsInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentAndApprovalsPage = ContentAndApprovalsPage;

View File

@@ -0,0 +1,254 @@
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 each
*/
export interface LegacyContentListInstanceEachOptions {
/** 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: LegacyContentInstance, 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 LegacyContentListInstanceOptions {
/** 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 LegacyContentListInstancePageOptions {
/** 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 LegacyContentSolution {
}
export interface LegacyContentListInstance {
_version: V1;
_solution: LegacyContentSolution;
_uri: string;
/**
* Streams LegacyContentInstance 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 { LegacyContentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: LegacyContentInstance, done: (err?: Error) => void) => void): void;
each(params: LegacyContentListInstanceEachOptions, callback?: (item: LegacyContentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams LegacyContentInstance 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 { LegacyContentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: LegacyContentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: LegacyContentListInstanceEachOptions, callback?: (item: LegacyContentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of LegacyContentInstance 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: LegacyContentPage) => any): Promise<LegacyContentPage>;
/**
* Retrieve a single target page of LegacyContentInstance 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<LegacyContentPage>) => any): Promise<ApiResponse<LegacyContentPage>>;
/**
* Lists LegacyContentInstance 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 { LegacyContentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: LegacyContentInstance[]) => any): Promise<LegacyContentInstance[]>;
list(params: LegacyContentListInstanceOptions, callback?: (error: Error | null, items: LegacyContentInstance[]) => any): Promise<LegacyContentInstance[]>;
/**
* Lists LegacyContentInstance 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 { LegacyContentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<LegacyContentInstance[]>) => any): Promise<ApiResponse<LegacyContentInstance[]>>;
listWithHttpInfo(params: LegacyContentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<LegacyContentInstance[]>) => any): Promise<ApiResponse<LegacyContentInstance[]>>;
/**
* Retrieve a single page of LegacyContentInstance 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 { LegacyContentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: LegacyContentPage) => any): Promise<LegacyContentPage>;
page(params: LegacyContentListInstancePageOptions, callback?: (error: Error | null, items: LegacyContentPage) => any): Promise<LegacyContentPage>;
/**
* Retrieve a single page of LegacyContentInstance 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 { LegacyContentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<LegacyContentPage>) => any): Promise<ApiResponse<LegacyContentPage>>;
pageWithHttpInfo(params: LegacyContentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<LegacyContentPage>) => any): Promise<ApiResponse<LegacyContentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function LegacyContentListInstance(version: V1): LegacyContentListInstance;
interface LegacyContentPayload extends TwilioResponsePayload {
contents: LegacyContentResource[];
}
interface LegacyContentResource {
date_created: Date;
date_updated: Date;
sid: string;
account_sid: string;
friendly_name: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
legacy_template_name: string;
legacy_body: string;
url: string;
}
export declare class LegacyContentInstance {
protected _version: V1;
constructor(_version: V1, payload: LegacyContentResource);
/**
* The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The unique string that that we created to identify the Content resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
*/
accountSid: string;
/**
* A string name used to describe the Content resource. Not visible to the end recipient.
*/
friendlyName: string;
/**
* Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
*/
language: string;
/**
* Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
*/
variables: Record<string, object>;
/**
* The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource.
*/
types: Record<string, object>;
/**
* The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed
*/
legacyTemplateName: string;
/**
* The string body field of the legacy content template associated with this Content resource
*/
legacyBody: string;
/**
* The URL of the resource, relative to `https://content.twilio.com`.
*/
url: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
dateCreated: Date;
dateUpdated: Date;
sid: string;
accountSid: string;
friendlyName: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
legacyTemplateName: string;
legacyBody: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class LegacyContentPage extends Page<V1, LegacyContentPayload, LegacyContentResource, LegacyContentInstance> {
/**
* Initialize the LegacyContentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: LegacyContentSolution);
/**
* Build an instance of LegacyContentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: LegacyContentResource): LegacyContentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,187 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.LegacyContentPage = exports.LegacyContentInstance = void 0;
exports.LegacyContentListInstance = LegacyContentListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function LegacyContentListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/LegacyContent`;
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 LegacyContentPage(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 LegacyContentPage(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 LegacyContentPage(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 LegacyContentPage(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 LegacyContentInstance {
constructor(_version, payload) {
this._version = _version;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.language = payload.language;
this.variables = payload.variables;
this.types = payload.types;
this.legacyTemplateName = payload.legacy_template_name;
this.legacyBody = payload.legacy_body;
this.url = payload.url;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
language: this.language,
variables: this.variables,
types: this.types,
legacyTemplateName: this.legacyTemplateName,
legacyBody: this.legacyBody,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LegacyContentInstance = LegacyContentInstance;
class LegacyContentPage extends Page_1.default {
/**
* Initialize the LegacyContentPage
*
* @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 LegacyContentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new LegacyContentInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LegacyContentPage = LegacyContentPage;

302
node_modules/twilio/lib/rest/content/v2/content.d.ts generated vendored Normal file
View File

@@ -0,0 +1,302 @@
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";
/**
* Options to pass to each
*/
export interface ContentListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Whether to sort by ascending or descending date updated */
sortByDate?: string;
/** Whether to sort by ascending or descending content name */
sortByContentName?: string;
/** Filter by >=[date-time] */
dateCreatedAfter?: Date;
/** Filter by <=[date-time] */
dateCreatedBefore?: Date;
/** Filter by Regex Pattern in content name */
contentName?: string;
/** Filter by Regex Pattern in template content */
content?: string;
/** Filter by array of valid language(s) */
language?: Array<string>;
/** Filter by array of contentType(s) */
contentType?: Array<string>;
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */
channelEligibility?: Array<string>;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ContentInstance, 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 ContentListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Whether to sort by ascending or descending date updated */
sortByDate?: string;
/** Whether to sort by ascending or descending content name */
sortByContentName?: string;
/** Filter by >=[date-time] */
dateCreatedAfter?: Date;
/** Filter by <=[date-time] */
dateCreatedBefore?: Date;
/** Filter by Regex Pattern in content name */
contentName?: string;
/** Filter by Regex Pattern in template content */
content?: string;
/** Filter by array of valid language(s) */
language?: Array<string>;
/** Filter by array of contentType(s) */
contentType?: Array<string>;
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */
channelEligibility?: 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 ContentListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Whether to sort by ascending or descending date updated */
sortByDate?: string;
/** Whether to sort by ascending or descending content name */
sortByContentName?: string;
/** Filter by >=[date-time] */
dateCreatedAfter?: Date;
/** Filter by <=[date-time] */
dateCreatedBefore?: Date;
/** Filter by Regex Pattern in content name */
contentName?: string;
/** Filter by Regex Pattern in template content */
content?: string;
/** Filter by array of valid language(s) */
language?: Array<string>;
/** Filter by array of contentType(s) */
contentType?: Array<string>;
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */
channelEligibility?: Array<string>;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ContentSolution {
}
export interface ContentListInstance {
_version: V2;
_solution: ContentSolution;
_uri: string;
/**
* Streams ContentInstance 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 { ContentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
each(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ContentInstance 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 { ContentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ContentInstance 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: ContentPage) => any): Promise<ContentPage>;
/**
* Retrieve a single target page of ContentInstance 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<ContentPage>) => any): Promise<ApiResponse<ContentPage>>;
/**
* Lists ContentInstance 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 { ContentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
list(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
/**
* Lists ContentInstance 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 { ContentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentInstance[]>) => any): Promise<ApiResponse<ContentInstance[]>>;
listWithHttpInfo(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ContentInstance[]>) => any): Promise<ApiResponse<ContentInstance[]>>;
/**
* Retrieve a single page of ContentInstance 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 { ContentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
page(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
/**
* Retrieve a single page of ContentInstance 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 { ContentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentPage>) => any): Promise<ApiResponse<ContentPage>>;
pageWithHttpInfo(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ContentPage>) => any): Promise<ApiResponse<ContentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ContentListInstance(version: V2): ContentListInstance;
interface ContentPayload extends TwilioResponsePayload {
contents: ContentResource[];
}
interface ContentResource {
date_created: Date;
date_updated: Date;
sid: string;
account_sid: string;
friendly_name: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
url: string;
links: Record<string, string>;
}
export declare class ContentInstance {
protected _version: V2;
constructor(_version: V2, payload: ContentResource);
/**
* The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The unique string that that we created to identify the Content resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
*/
accountSid: string;
/**
* A string name used to describe the Content resource. Not visible to the end recipient.
*/
friendlyName: string;
/**
* Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
*/
language: string;
/**
* Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
*/
variables: Record<string, object>;
/**
* The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource.
*/
types: Record<string, object>;
/**
* The URL of the resource, relative to `https://content.twilio.com`.
*/
url: string;
/**
* A list of links related to the Content resource, such as approval_fetch and approval_create
*/
links: Record<string, string>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
dateCreated: Date;
dateUpdated: Date;
sid: string;
accountSid: string;
friendlyName: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class ContentPage extends Page<V2, ContentPayload, ContentResource, ContentInstance> {
/**
* Initialize the ContentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: ContentSolution);
/**
* Build an instance of ContentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ContentResource): ContentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

221
node_modules/twilio/lib/rest/content/v2/content.js generated vendored Normal file
View File

@@ -0,0 +1,221 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.ContentPage = exports.ContentInstance = void 0;
exports.ContentListInstance = ContentListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function ContentListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Content`;
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["sortByDate"] !== undefined)
data["SortByDate"] = params["sortByDate"];
if (params["sortByContentName"] !== undefined)
data["SortByContentName"] = params["sortByContentName"];
if (params["dateCreatedAfter"] !== undefined)
data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]);
if (params["dateCreatedBefore"] !== undefined)
data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]);
if (params["contentName"] !== undefined)
data["ContentName"] = params["contentName"];
if (params["content"] !== undefined)
data["Content"] = params["content"];
if (params["language"] !== undefined)
data["Language"] = serialize.map(params["language"], (e) => e);
if (params["contentType"] !== undefined)
data["ContentType"] = serialize.map(params["contentType"], (e) => e);
if (params["channelEligibility"] !== undefined)
data["ChannelEligibility"] = serialize.map(params["channelEligibility"], (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 ContentPage(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 ContentPage(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["sortByDate"] !== undefined)
data["SortByDate"] = params["sortByDate"];
if (params["sortByContentName"] !== undefined)
data["SortByContentName"] = params["sortByContentName"];
if (params["dateCreatedAfter"] !== undefined)
data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]);
if (params["dateCreatedBefore"] !== undefined)
data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]);
if (params["contentName"] !== undefined)
data["ContentName"] = params["contentName"];
if (params["content"] !== undefined)
data["Content"] = params["content"];
if (params["language"] !== undefined)
data["Language"] = serialize.map(params["language"], (e) => e);
if (params["contentType"] !== undefined)
data["ContentType"] = serialize.map(params["contentType"], (e) => e);
if (params["channelEligibility"] !== undefined)
data["ChannelEligibility"] = serialize.map(params["channelEligibility"], (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 ContentPage(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 ContentPage(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 ContentInstance {
constructor(_version, payload) {
this._version = _version;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.language = payload.language;
this.variables = payload.variables;
this.types = payload.types;
this.url = payload.url;
this.links = payload.links;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
language: this.language,
variables: this.variables,
types: this.types,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentInstance = ContentInstance;
class ContentPage extends Page_1.default {
/**
* Initialize the ContentPage
*
* @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 ContentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ContentInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentPage = ContentPage;

View File

@@ -0,0 +1,296 @@
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";
/**
* Options to pass to each
*/
export interface ContentAndApprovalsListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Whether to sort by ascending or descending date updated */
sortByDate?: string;
/** Whether to sort by ascending or descending content name */
sortByContentName?: string;
/** Filter by >=[date-time] */
dateCreatedAfter?: Date;
/** Filter by <=[date-time] */
dateCreatedBefore?: Date;
/** Filter by Regex Pattern in content name */
contentName?: string;
/** Filter by Regex Pattern in template content */
content?: string;
/** Filter by array of valid language(s) */
language?: Array<string>;
/** Filter by array of contentType(s) */
contentType?: Array<string>;
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */
channelEligibility?: Array<string>;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ContentAndApprovalsInstance, 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 ContentAndApprovalsListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Whether to sort by ascending or descending date updated */
sortByDate?: string;
/** Whether to sort by ascending or descending content name */
sortByContentName?: string;
/** Filter by >=[date-time] */
dateCreatedAfter?: Date;
/** Filter by <=[date-time] */
dateCreatedBefore?: Date;
/** Filter by Regex Pattern in content name */
contentName?: string;
/** Filter by Regex Pattern in template content */
content?: string;
/** Filter by array of valid language(s) */
language?: Array<string>;
/** Filter by array of contentType(s) */
contentType?: Array<string>;
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */
channelEligibility?: 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 ContentAndApprovalsListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Whether to sort by ascending or descending date updated */
sortByDate?: string;
/** Whether to sort by ascending or descending content name */
sortByContentName?: string;
/** Filter by >=[date-time] */
dateCreatedAfter?: Date;
/** Filter by <=[date-time] */
dateCreatedBefore?: Date;
/** Filter by Regex Pattern in content name */
contentName?: string;
/** Filter by Regex Pattern in template content */
content?: string;
/** Filter by array of valid language(s) */
language?: Array<string>;
/** Filter by array of contentType(s) */
contentType?: Array<string>;
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */
channelEligibility?: Array<string>;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ContentAndApprovalsSolution {
}
export interface ContentAndApprovalsListInstance {
_version: V2;
_solution: ContentAndApprovalsSolution;
_uri: string;
/**
* Streams ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
each(params: ContentAndApprovalsListInstanceEachOptions, callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ContentAndApprovalsListInstanceEachOptions, callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ContentAndApprovalsInstance 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: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>;
/**
* Retrieve a single target page of ContentAndApprovalsInstance 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<ContentAndApprovalsPage>) => any): Promise<ApiResponse<ContentAndApprovalsPage>>;
/**
* Lists ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>;
list(params: ContentAndApprovalsListInstanceOptions, callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>;
/**
* Lists ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsInstance[]>) => any): Promise<ApiResponse<ContentAndApprovalsInstance[]>>;
listWithHttpInfo(params: ContentAndApprovalsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsInstance[]>) => any): Promise<ApiResponse<ContentAndApprovalsInstance[]>>;
/**
* Retrieve a single page of ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>;
page(params: ContentAndApprovalsListInstancePageOptions, callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>;
/**
* Retrieve a single page of ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsPage>) => any): Promise<ApiResponse<ContentAndApprovalsPage>>;
pageWithHttpInfo(params: ContentAndApprovalsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ContentAndApprovalsPage>) => any): Promise<ApiResponse<ContentAndApprovalsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ContentAndApprovalsListInstance(version: V2): ContentAndApprovalsListInstance;
interface ContentAndApprovalsPayload extends TwilioResponsePayload {
contents: ContentAndApprovalsResource[];
}
interface ContentAndApprovalsResource {
date_created: Date;
date_updated: Date;
sid: string;
account_sid: string;
friendly_name: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
approval_requests: Record<string, object>;
}
export declare class ContentAndApprovalsInstance {
protected _version: V2;
constructor(_version: V2, payload: ContentAndApprovalsResource);
/**
* The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The unique string that that we created to identify the Content resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
*/
accountSid: string;
/**
* A string name used to describe the Content resource. Not visible to the end recipient.
*/
friendlyName: string;
/**
* Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
*/
language: string;
/**
* Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
*/
variables: Record<string, object>;
/**
* The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource.
*/
types: Record<string, object>;
/**
* The submitted information and approval request status of the Content resource.
*/
approvalRequests: Record<string, object>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
dateCreated: Date;
dateUpdated: Date;
sid: string;
accountSid: string;
friendlyName: string;
language: string;
variables: Record<string, object>;
types: Record<string, object>;
approvalRequests: Record<string, object>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class ContentAndApprovalsPage extends Page<V2, ContentAndApprovalsPayload, ContentAndApprovalsResource, ContentAndApprovalsInstance> {
/**
* Initialize the ContentAndApprovalsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: ContentAndApprovalsSolution);
/**
* Build an instance of ContentAndApprovalsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ContentAndApprovalsResource): ContentAndApprovalsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,219 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Content
* 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.ContentAndApprovalsPage = exports.ContentAndApprovalsInstance = void 0;
exports.ContentAndApprovalsListInstance = ContentAndApprovalsListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function ContentAndApprovalsListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/ContentAndApprovals`;
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["sortByDate"] !== undefined)
data["SortByDate"] = params["sortByDate"];
if (params["sortByContentName"] !== undefined)
data["SortByContentName"] = params["sortByContentName"];
if (params["dateCreatedAfter"] !== undefined)
data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]);
if (params["dateCreatedBefore"] !== undefined)
data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]);
if (params["contentName"] !== undefined)
data["ContentName"] = params["contentName"];
if (params["content"] !== undefined)
data["Content"] = params["content"];
if (params["language"] !== undefined)
data["Language"] = serialize.map(params["language"], (e) => e);
if (params["contentType"] !== undefined)
data["ContentType"] = serialize.map(params["contentType"], (e) => e);
if (params["channelEligibility"] !== undefined)
data["ChannelEligibility"] = serialize.map(params["channelEligibility"], (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 ContentAndApprovalsPage(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 ContentAndApprovalsPage(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["sortByDate"] !== undefined)
data["SortByDate"] = params["sortByDate"];
if (params["sortByContentName"] !== undefined)
data["SortByContentName"] = params["sortByContentName"];
if (params["dateCreatedAfter"] !== undefined)
data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]);
if (params["dateCreatedBefore"] !== undefined)
data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]);
if (params["contentName"] !== undefined)
data["ContentName"] = params["contentName"];
if (params["content"] !== undefined)
data["Content"] = params["content"];
if (params["language"] !== undefined)
data["Language"] = serialize.map(params["language"], (e) => e);
if (params["contentType"] !== undefined)
data["ContentType"] = serialize.map(params["contentType"], (e) => e);
if (params["channelEligibility"] !== undefined)
data["ChannelEligibility"] = serialize.map(params["channelEligibility"], (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 ContentAndApprovalsPage(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 ContentAndApprovalsPage(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 ContentAndApprovalsInstance {
constructor(_version, payload) {
this._version = _version;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.language = payload.language;
this.variables = payload.variables;
this.types = payload.types;
this.approvalRequests = payload.approval_requests;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
language: this.language,
variables: this.variables,
types: this.types,
approvalRequests: this.approvalRequests,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentAndApprovalsInstance = ContentAndApprovalsInstance;
class ContentAndApprovalsPage extends Page_1.default {
/**
* Initialize the ContentAndApprovalsPage
*
* @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 ContentAndApprovalsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ContentAndApprovalsInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ContentAndApprovalsPage = ContentAndApprovalsPage;