Auto-commit 2026-04-29 16:31
This commit is contained in:
30
node_modules/twilio/lib/rest/events/V1.d.ts
generated
vendored
Normal file
30
node_modules/twilio/lib/rest/events/V1.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import EventsBase from "../EventsBase";
|
||||
import Version from "../../base/Version";
|
||||
import { EventTypeListInstance } from "./v1/eventType";
|
||||
import { SchemaListInstance } from "./v1/schema";
|
||||
import { SinkListInstance } from "./v1/sink";
|
||||
import { SubscriptionListInstance } from "./v1/subscription";
|
||||
export default class V1 extends Version {
|
||||
/**
|
||||
* Initialize the V1 version of Events
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.Events) domain
|
||||
*/
|
||||
constructor(domain: EventsBase);
|
||||
/** eventTypes - { Twilio.Events.V1.EventTypeListInstance } resource */
|
||||
protected _eventTypes?: EventTypeListInstance;
|
||||
/** schemas - { Twilio.Events.V1.SchemaListInstance } resource */
|
||||
protected _schemas?: SchemaListInstance;
|
||||
/** sinks - { Twilio.Events.V1.SinkListInstance } resource */
|
||||
protected _sinks?: SinkListInstance;
|
||||
/** subscriptions - { Twilio.Events.V1.SubscriptionListInstance } resource */
|
||||
protected _subscriptions?: SubscriptionListInstance;
|
||||
/** Getter for eventTypes resource */
|
||||
get eventTypes(): EventTypeListInstance;
|
||||
/** Getter for schemas resource */
|
||||
get schemas(): SchemaListInstance;
|
||||
/** Getter for sinks resource */
|
||||
get sinks(): SinkListInstance;
|
||||
/** Getter for subscriptions resource */
|
||||
get subscriptions(): SubscriptionListInstance;
|
||||
}
|
||||
54
node_modules/twilio/lib/rest/events/V1.js
generated
vendored
Normal file
54
node_modules/twilio/lib/rest/events/V1.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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 eventType_1 = require("./v1/eventType");
|
||||
const schema_1 = require("./v1/schema");
|
||||
const sink_1 = require("./v1/sink");
|
||||
const subscription_1 = require("./v1/subscription");
|
||||
class V1 extends Version_1.default {
|
||||
/**
|
||||
* Initialize the V1 version of Events
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.Events) domain
|
||||
*/
|
||||
constructor(domain) {
|
||||
super(domain, "v1");
|
||||
}
|
||||
/** Getter for eventTypes resource */
|
||||
get eventTypes() {
|
||||
this._eventTypes = this._eventTypes || (0, eventType_1.EventTypeListInstance)(this);
|
||||
return this._eventTypes;
|
||||
}
|
||||
/** Getter for schemas resource */
|
||||
get schemas() {
|
||||
this._schemas = this._schemas || (0, schema_1.SchemaListInstance)(this);
|
||||
return this._schemas;
|
||||
}
|
||||
/** Getter for sinks resource */
|
||||
get sinks() {
|
||||
this._sinks = this._sinks || (0, sink_1.SinkListInstance)(this);
|
||||
return this._sinks;
|
||||
}
|
||||
/** Getter for subscriptions resource */
|
||||
get subscriptions() {
|
||||
this._subscriptions = this._subscriptions || (0, subscription_1.SubscriptionListInstance)(this);
|
||||
return this._subscriptions;
|
||||
}
|
||||
}
|
||||
exports.default = V1;
|
||||
307
node_modules/twilio/lib/rest/events/v1/eventType.d.ts
generated
vendored
Normal file
307
node_modules/twilio/lib/rest/events/v1/eventType.d.ts
generated
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
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 EventTypeListInstanceEachOptions {
|
||||
/** A string parameter filtering the results to return only the Event Types using a given schema. */
|
||||
schemaId?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: EventTypeInstance, 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 EventTypeListInstanceOptions {
|
||||
/** A string parameter filtering the results to return only the Event Types using a given schema. */
|
||||
schemaId?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to page
|
||||
*/
|
||||
export interface EventTypeListInstancePageOptions {
|
||||
/** A string parameter filtering the results to return only the Event Types using a given schema. */
|
||||
schemaId?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface EventTypeContext {
|
||||
/**
|
||||
* Fetch a EventTypeInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EventTypeInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: EventTypeInstance) => any): Promise<EventTypeInstance>;
|
||||
/**
|
||||
* Fetch a EventTypeInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EventTypeInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EventTypeInstance>) => any): Promise<ApiResponse<EventTypeInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface EventTypeContextSolution {
|
||||
type: string;
|
||||
}
|
||||
export declare class EventTypeContextImpl implements EventTypeContext {
|
||||
protected _version: V1;
|
||||
protected _solution: EventTypeContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, type: string);
|
||||
fetch(callback?: (error: Error | null, item?: EventTypeInstance) => any): Promise<EventTypeInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EventTypeInstance>) => any): Promise<ApiResponse<EventTypeInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): EventTypeContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface EventTypePayload extends TwilioResponsePayload {
|
||||
types: EventTypeResource[];
|
||||
}
|
||||
interface EventTypeResource {
|
||||
type: string;
|
||||
schema_id: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
description: string;
|
||||
status: string;
|
||||
documentation_url: string;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class EventTypeInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: EventTypeContextSolution;
|
||||
protected _context?: EventTypeContext;
|
||||
constructor(_version: V1, payload: EventTypeResource, type?: string);
|
||||
/**
|
||||
* A string that uniquely identifies this Event Type.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* A string that uniquely identifies the Schema this Event Type adheres to.
|
||||
*/
|
||||
schemaId: string;
|
||||
/**
|
||||
* The date that this Event Type was created, given in ISO 8601 format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date that this Event Type was updated, given in ISO 8601 format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* A human readable description for this Event Type.
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* A string that describes how this Event Type can be used. For example: `available`, `deprecated`, `restricted`, `discontinued`. When the status is `available`, the Event Type can be used normally.
|
||||
*/
|
||||
status: string;
|
||||
/**
|
||||
* The URL to the documentation or to the most relevant Twilio Changelog entry of this Event Type.
|
||||
*/
|
||||
documentationUrl: string;
|
||||
/**
|
||||
* The URL of this resource.
|
||||
*/
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a EventTypeInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EventTypeInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: EventTypeInstance) => any): Promise<EventTypeInstance>;
|
||||
/**
|
||||
* Fetch a EventTypeInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EventTypeInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EventTypeInstance>) => any): Promise<ApiResponse<EventTypeInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
type: string;
|
||||
schemaId: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
description: string;
|
||||
status: string;
|
||||
documentationUrl: string;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface EventTypeSolution {
|
||||
}
|
||||
export interface EventTypeListInstance {
|
||||
_version: V1;
|
||||
_solution: EventTypeSolution;
|
||||
_uri: string;
|
||||
(type: string): EventTypeContext;
|
||||
get(type: string): EventTypeContext;
|
||||
/**
|
||||
* Streams EventTypeInstance 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 { EventTypeListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: EventTypeInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: EventTypeListInstanceEachOptions, callback?: (item: EventTypeInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams EventTypeInstance 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 { EventTypeListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: EventTypeInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: EventTypeListInstanceEachOptions, callback?: (item: EventTypeInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of EventTypeInstance 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: EventTypePage) => any): Promise<EventTypePage>;
|
||||
/**
|
||||
* Retrieve a single target page of EventTypeInstance 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<EventTypePage>) => any): Promise<ApiResponse<EventTypePage>>;
|
||||
/**
|
||||
* Lists EventTypeInstance 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 { EventTypeListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: EventTypeInstance[]) => any): Promise<EventTypeInstance[]>;
|
||||
list(params: EventTypeListInstanceOptions, callback?: (error: Error | null, items: EventTypeInstance[]) => any): Promise<EventTypeInstance[]>;
|
||||
/**
|
||||
* Lists EventTypeInstance 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 { EventTypeListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EventTypeInstance[]>) => any): Promise<ApiResponse<EventTypeInstance[]>>;
|
||||
listWithHttpInfo(params: EventTypeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EventTypeInstance[]>) => any): Promise<ApiResponse<EventTypeInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of EventTypeInstance 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 { EventTypeListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: EventTypePage) => any): Promise<EventTypePage>;
|
||||
page(params: EventTypeListInstancePageOptions, callback?: (error: Error | null, items: EventTypePage) => any): Promise<EventTypePage>;
|
||||
/**
|
||||
* Retrieve a single page of EventTypeInstance 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 { EventTypeListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EventTypePage>) => any): Promise<ApiResponse<EventTypePage>>;
|
||||
pageWithHttpInfo(params: EventTypeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EventTypePage>) => any): Promise<ApiResponse<EventTypePage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function EventTypeListInstance(version: V1): EventTypeListInstance;
|
||||
export declare class EventTypePage extends Page<V1, EventTypePayload, EventTypeResource, EventTypeInstance> {
|
||||
/**
|
||||
* Initialize the EventTypePage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: EventTypeSolution);
|
||||
/**
|
||||
* Build an instance of EventTypeInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: EventTypeResource): EventTypeInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
272
node_modules/twilio/lib/rest/events/v1/eventType.js
generated
vendored
Normal file
272
node_modules/twilio/lib/rest/events/v1/eventType.js
generated
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.EventTypePage = exports.EventTypeInstance = exports.EventTypeContextImpl = void 0;
|
||||
exports.EventTypeListInstance = EventTypeListInstance;
|
||||
const util_1 = require("util");
|
||||
const Page_1 = __importDefault(require("../../../base/Page"));
|
||||
const deserialize = require("../../../base/deserialize");
|
||||
const serialize = require("../../../base/serialize");
|
||||
const utility_1 = require("../../../base/utility");
|
||||
class EventTypeContextImpl {
|
||||
constructor(_version, type) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(type)) {
|
||||
throw new Error("Parameter 'type' is not valid.");
|
||||
}
|
||||
this._solution = { type };
|
||||
this._uri = `/Types/${type}`;
|
||||
}
|
||||
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 EventTypeInstance(operationVersion, payload, instance._solution.type));
|
||||
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 EventTypeInstance(operationVersion, response.body, instance._solution.type),
|
||||
}));
|
||||
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.EventTypeContextImpl = EventTypeContextImpl;
|
||||
class EventTypeInstance {
|
||||
constructor(_version, payload, type) {
|
||||
this._version = _version;
|
||||
this.type = payload.type;
|
||||
this.schemaId = payload.schema_id;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.description = payload.description;
|
||||
this.status = payload.status;
|
||||
this.documentationUrl = payload.documentation_url;
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { type: type || this.type };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new EventTypeContextImpl(this._version, this._solution.type);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a EventTypeInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EventTypeInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a EventTypeInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EventTypeInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
type: this.type,
|
||||
schemaId: this.schemaId,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
description: this.description,
|
||||
status: this.status,
|
||||
documentationUrl: this.documentationUrl,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.EventTypeInstance = EventTypeInstance;
|
||||
function EventTypeListInstance(version) {
|
||||
const instance = ((type) => instance.get(type));
|
||||
instance.get = function get(type) {
|
||||
return new EventTypeContextImpl(version, type);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/Types`;
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["schemaId"] !== undefined)
|
||||
data["SchemaId"] = params["schemaId"];
|
||||
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 EventTypePage(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 EventTypePage(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["schemaId"] !== undefined)
|
||||
data["SchemaId"] = params["schemaId"];
|
||||
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 EventTypePage(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 EventTypePage(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 EventTypePage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the EventTypePage
|
||||
*
|
||||
* @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 EventTypeInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new EventTypeInstance(this._version, payload);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.EventTypePage = EventTypePage;
|
||||
131
node_modules/twilio/lib/rest/events/v1/schema.d.ts
generated
vendored
Normal file
131
node_modules/twilio/lib/rest/events/v1/schema.d.ts
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../V1";
|
||||
import { ApiResponse } from "../../../base/ApiResponse";
|
||||
import { SchemaVersionListInstance } from "./schema/schemaVersion";
|
||||
export interface SchemaContext {
|
||||
versions: SchemaVersionListInstance;
|
||||
/**
|
||||
* Fetch a SchemaInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SchemaInstance) => any): Promise<SchemaInstance>;
|
||||
/**
|
||||
* Fetch a SchemaInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SchemaInstance>) => any): Promise<ApiResponse<SchemaInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface SchemaContextSolution {
|
||||
id: string;
|
||||
}
|
||||
export declare class SchemaContextImpl implements SchemaContext {
|
||||
protected _version: V1;
|
||||
protected _solution: SchemaContextSolution;
|
||||
protected _uri: string;
|
||||
protected _versions?: SchemaVersionListInstance;
|
||||
constructor(_version: V1, id: string);
|
||||
get versions(): SchemaVersionListInstance;
|
||||
fetch(callback?: (error: Error | null, item?: SchemaInstance) => any): Promise<SchemaInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SchemaInstance>) => any): Promise<ApiResponse<SchemaInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): SchemaContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface SchemaResource {
|
||||
id: string;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
latest_version_date_created: Date;
|
||||
latest_version: number;
|
||||
}
|
||||
export declare class SchemaInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: SchemaContextSolution;
|
||||
protected _context?: SchemaContext;
|
||||
constructor(_version: V1, payload: SchemaResource, id?: string);
|
||||
/**
|
||||
* The unique identifier of the schema. Each schema can have multiple versions, that share the same id.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The URL of this resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Contains a dictionary of URL links to nested resources of this schema.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
/**
|
||||
* The date that the latest schema version was created, given in ISO 8601 format.
|
||||
*/
|
||||
latestVersionDateCreated: Date;
|
||||
/**
|
||||
* The latest version published of this schema.
|
||||
*/
|
||||
latestVersion: number;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a SchemaInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SchemaInstance) => any): Promise<SchemaInstance>;
|
||||
/**
|
||||
* Fetch a SchemaInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SchemaInstance>) => any): Promise<ApiResponse<SchemaInstance>>;
|
||||
/**
|
||||
* Access the versions.
|
||||
*/
|
||||
versions(): SchemaVersionListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
id: string;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
latestVersionDateCreated: Date;
|
||||
latestVersion: number;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface SchemaSolution {
|
||||
}
|
||||
export interface SchemaListInstance {
|
||||
_version: V1;
|
||||
_solution: SchemaSolution;
|
||||
_uri: string;
|
||||
(id: string): SchemaContext;
|
||||
get(id: string): SchemaContext;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SchemaListInstance(version: V1): SchemaListInstance;
|
||||
export {};
|
||||
158
node_modules/twilio/lib/rest/events/v1/schema.js
generated
vendored
Normal file
158
node_modules/twilio/lib/rest/events/v1/schema.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SchemaInstance = exports.SchemaContextImpl = void 0;
|
||||
exports.SchemaListInstance = SchemaListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../base/deserialize");
|
||||
const serialize = require("../../../base/serialize");
|
||||
const utility_1 = require("../../../base/utility");
|
||||
const schemaVersion_1 = require("./schema/schemaVersion");
|
||||
class SchemaContextImpl {
|
||||
constructor(_version, id) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(id)) {
|
||||
throw new Error("Parameter 'id' is not valid.");
|
||||
}
|
||||
this._solution = { id };
|
||||
this._uri = `/Schemas/${id}`;
|
||||
}
|
||||
get versions() {
|
||||
this._versions =
|
||||
this._versions ||
|
||||
(0, schemaVersion_1.SchemaVersionListInstance)(this._version, this._solution.id);
|
||||
return this._versions;
|
||||
}
|
||||
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 SchemaInstance(operationVersion, payload, instance._solution.id));
|
||||
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 SchemaInstance(operationVersion, response.body, instance._solution.id),
|
||||
}));
|
||||
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.SchemaContextImpl = SchemaContextImpl;
|
||||
class SchemaInstance {
|
||||
constructor(_version, payload, id) {
|
||||
this._version = _version;
|
||||
this.id = payload.id;
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this.latestVersionDateCreated = deserialize.iso8601DateTime(payload.latest_version_date_created);
|
||||
this.latestVersion = deserialize.integer(payload.latest_version);
|
||||
this._solution = { id: id || this.id };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context || new SchemaContextImpl(this._version, this._solution.id);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a SchemaInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a SchemaInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Access the versions.
|
||||
*/
|
||||
versions() {
|
||||
return this._proxy.versions;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
latestVersionDateCreated: this.latestVersionDateCreated,
|
||||
latestVersion: this.latestVersion,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SchemaInstance = SchemaInstance;
|
||||
function SchemaListInstance(version) {
|
||||
const instance = ((id) => instance.get(id));
|
||||
instance.get = function get(id) {
|
||||
return new SchemaContextImpl(version, id);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = ``;
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
279
node_modules/twilio/lib/rest/events/v1/schema/schemaVersion.d.ts
generated
vendored
Normal file
279
node_modules/twilio/lib/rest/events/v1/schema/schemaVersion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,279 @@
|
||||
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 SchemaVersionListInstanceEachOptions {
|
||||
/** 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: SchemaVersionInstance, 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 SchemaVersionListInstanceOptions {
|
||||
/** 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 SchemaVersionListInstancePageOptions {
|
||||
/** 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 SchemaVersionContext {
|
||||
/**
|
||||
* Fetch a SchemaVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaVersionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SchemaVersionInstance) => any): Promise<SchemaVersionInstance>;
|
||||
/**
|
||||
* Fetch a SchemaVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SchemaVersionInstance>) => any): Promise<ApiResponse<SchemaVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface SchemaVersionContextSolution {
|
||||
id: string;
|
||||
schemaVersion: number;
|
||||
}
|
||||
export declare class SchemaVersionContextImpl implements SchemaVersionContext {
|
||||
protected _version: V1;
|
||||
protected _solution: SchemaVersionContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, id: string, schemaVersion: number);
|
||||
fetch(callback?: (error: Error | null, item?: SchemaVersionInstance) => any): Promise<SchemaVersionInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SchemaVersionInstance>) => any): Promise<ApiResponse<SchemaVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): SchemaVersionContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface SchemaVersionPayload extends TwilioResponsePayload {
|
||||
schema_versions: SchemaVersionResource[];
|
||||
}
|
||||
interface SchemaVersionResource {
|
||||
id: string;
|
||||
schema_version: number;
|
||||
date_created: Date;
|
||||
url: string;
|
||||
raw: string;
|
||||
}
|
||||
export declare class SchemaVersionInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: SchemaVersionContextSolution;
|
||||
protected _context?: SchemaVersionContext;
|
||||
constructor(_version: V1, payload: SchemaVersionResource, id: string, schemaVersion?: number);
|
||||
/**
|
||||
* The unique identifier of the schema. Each schema can have multiple versions, that share the same id.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The version of this schema.
|
||||
*/
|
||||
schemaVersion: number;
|
||||
/**
|
||||
* The date the schema version was created, given in ISO 8601 format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The URL of this resource.
|
||||
*/
|
||||
url: string;
|
||||
raw: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a SchemaVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaVersionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SchemaVersionInstance) => any): Promise<SchemaVersionInstance>;
|
||||
/**
|
||||
* Fetch a SchemaVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SchemaVersionInstance>) => any): Promise<ApiResponse<SchemaVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
id: string;
|
||||
schemaVersion: number;
|
||||
dateCreated: Date;
|
||||
url: string;
|
||||
raw: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface SchemaVersionSolution {
|
||||
id: string;
|
||||
}
|
||||
export interface SchemaVersionListInstance {
|
||||
_version: V1;
|
||||
_solution: SchemaVersionSolution;
|
||||
_uri: string;
|
||||
(schemaVersion: number): SchemaVersionContext;
|
||||
get(schemaVersion: number): SchemaVersionContext;
|
||||
/**
|
||||
* Streams SchemaVersionInstance 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 { SchemaVersionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: SchemaVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: SchemaVersionListInstanceEachOptions, callback?: (item: SchemaVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams SchemaVersionInstance 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 { SchemaVersionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: SchemaVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: SchemaVersionListInstanceEachOptions, callback?: (item: SchemaVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of SchemaVersionInstance 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: SchemaVersionPage) => any): Promise<SchemaVersionPage>;
|
||||
/**
|
||||
* Retrieve a single target page of SchemaVersionInstance 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<SchemaVersionPage>) => any): Promise<ApiResponse<SchemaVersionPage>>;
|
||||
/**
|
||||
* Lists SchemaVersionInstance 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 { SchemaVersionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: SchemaVersionInstance[]) => any): Promise<SchemaVersionInstance[]>;
|
||||
list(params: SchemaVersionListInstanceOptions, callback?: (error: Error | null, items: SchemaVersionInstance[]) => any): Promise<SchemaVersionInstance[]>;
|
||||
/**
|
||||
* Lists SchemaVersionInstance 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 { SchemaVersionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SchemaVersionInstance[]>) => any): Promise<ApiResponse<SchemaVersionInstance[]>>;
|
||||
listWithHttpInfo(params: SchemaVersionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SchemaVersionInstance[]>) => any): Promise<ApiResponse<SchemaVersionInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of SchemaVersionInstance 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 { SchemaVersionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: SchemaVersionPage) => any): Promise<SchemaVersionPage>;
|
||||
page(params: SchemaVersionListInstancePageOptions, callback?: (error: Error | null, items: SchemaVersionPage) => any): Promise<SchemaVersionPage>;
|
||||
/**
|
||||
* Retrieve a single page of SchemaVersionInstance 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 { SchemaVersionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SchemaVersionPage>) => any): Promise<ApiResponse<SchemaVersionPage>>;
|
||||
pageWithHttpInfo(params: SchemaVersionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SchemaVersionPage>) => any): Promise<ApiResponse<SchemaVersionPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SchemaVersionListInstance(version: V1, id: string): SchemaVersionListInstance;
|
||||
export declare class SchemaVersionPage extends Page<V1, SchemaVersionPayload, SchemaVersionResource, SchemaVersionInstance> {
|
||||
/**
|
||||
* Initialize the SchemaVersionPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: SchemaVersionSolution);
|
||||
/**
|
||||
* Build an instance of SchemaVersionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: SchemaVersionResource): SchemaVersionInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
266
node_modules/twilio/lib/rest/events/v1/schema/schemaVersion.js
generated
vendored
Normal file
266
node_modules/twilio/lib/rest/events/v1/schema/schemaVersion.js
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SchemaVersionPage = exports.SchemaVersionInstance = exports.SchemaVersionContextImpl = void 0;
|
||||
exports.SchemaVersionListInstance = SchemaVersionListInstance;
|
||||
const util_1 = require("util");
|
||||
const Page_1 = __importDefault(require("../../../../base/Page"));
|
||||
const deserialize = require("../../../../base/deserialize");
|
||||
const serialize = require("../../../../base/serialize");
|
||||
const utility_1 = require("../../../../base/utility");
|
||||
class SchemaVersionContextImpl {
|
||||
constructor(_version, id, schemaVersion) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(id)) {
|
||||
throw new Error("Parameter 'id' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(schemaVersion)) {
|
||||
throw new Error("Parameter 'schemaVersion' is not valid.");
|
||||
}
|
||||
this._solution = { id, schemaVersion };
|
||||
this._uri = `/Schemas/${id}/Versions/${schemaVersion}`;
|
||||
}
|
||||
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 SchemaVersionInstance(operationVersion, payload, instance._solution.id, instance._solution.schemaVersion));
|
||||
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 SchemaVersionInstance(operationVersion, response.body, instance._solution.id, instance._solution.schemaVersion),
|
||||
}));
|
||||
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.SchemaVersionContextImpl = SchemaVersionContextImpl;
|
||||
class SchemaVersionInstance {
|
||||
constructor(_version, payload, id, schemaVersion) {
|
||||
this._version = _version;
|
||||
this.id = payload.id;
|
||||
this.schemaVersion = deserialize.integer(payload.schema_version);
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.url = payload.url;
|
||||
this.raw = payload.raw;
|
||||
this._solution = { id, schemaVersion: schemaVersion || this.schemaVersion };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new SchemaVersionContextImpl(this._version, this._solution.id, this._solution.schemaVersion);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a SchemaVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaVersionInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a SchemaVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SchemaVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
schemaVersion: this.schemaVersion,
|
||||
dateCreated: this.dateCreated,
|
||||
url: this.url,
|
||||
raw: this.raw,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SchemaVersionInstance = SchemaVersionInstance;
|
||||
function SchemaVersionListInstance(version, id) {
|
||||
if (!(0, utility_1.isValidPathParam)(id)) {
|
||||
throw new Error("Parameter 'id' is not valid.");
|
||||
}
|
||||
const instance = ((schemaVersion) => instance.get(schemaVersion));
|
||||
instance.get = function get(schemaVersion) {
|
||||
return new SchemaVersionContextImpl(version, id, schemaVersion);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { id };
|
||||
instance._uri = `/Schemas/${id}/Versions`;
|
||||
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 SchemaVersionPage(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 SchemaVersionPage(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 SchemaVersionPage(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 SchemaVersionPage(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 SchemaVersionPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the SchemaVersionPage
|
||||
*
|
||||
* @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 SchemaVersionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new SchemaVersionInstance(this._version, payload, this._solution.id);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SchemaVersionPage = SchemaVersionPage;
|
||||
442
node_modules/twilio/lib/rest/events/v1/sink.d.ts
generated
vendored
Normal file
442
node_modules/twilio/lib/rest/events/v1/sink.d.ts
generated
vendored
Normal file
@@ -0,0 +1,442 @@
|
||||
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 { SinkTestListInstance } from "./sink/sinkTest";
|
||||
import { SinkValidateListInstance } from "./sink/sinkValidate";
|
||||
/**
|
||||
* The Sink type. Can only be \"kinesis\" or \"webhook\" currently.
|
||||
*/
|
||||
export type SinkSinkType = "kinesis" | "webhook" | "segment" | "email";
|
||||
/**
|
||||
* The Status of this Sink. One of `initialized`, `validating`, `active` or `failed`.
|
||||
*/
|
||||
export type SinkStatus = "initialized" | "validating" | "active" | "failed";
|
||||
/**
|
||||
* Options to pass to update a SinkInstance
|
||||
*/
|
||||
export interface SinkContextUpdateOptions {
|
||||
/** A human readable description for the Sink **This value should not contain PII.** */
|
||||
description: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a SinkInstance
|
||||
*/
|
||||
export interface SinkListInstanceCreateOptions {
|
||||
/** A human readable description for the Sink **This value should not contain PII.** */
|
||||
description: string;
|
||||
/** The information required for Twilio to connect to the provided Sink encoded as JSON. */
|
||||
sinkConfiguration: any;
|
||||
/** */
|
||||
sinkType: SinkSinkType;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface SinkListInstanceEachOptions {
|
||||
/** A boolean query parameter filtering the results to return sinks used/not used by a subscription. */
|
||||
inUse?: boolean;
|
||||
/** A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. */
|
||||
status?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: SinkInstance, 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 SinkListInstanceOptions {
|
||||
/** A boolean query parameter filtering the results to return sinks used/not used by a subscription. */
|
||||
inUse?: boolean;
|
||||
/** A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. */
|
||||
status?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to page
|
||||
*/
|
||||
export interface SinkListInstancePageOptions {
|
||||
/** A boolean query parameter filtering the results to return sinks used/not used by a subscription. */
|
||||
inUse?: boolean;
|
||||
/** A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. */
|
||||
status?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface SinkContext {
|
||||
sinkTest: SinkTestListInstance;
|
||||
sinkValidate: SinkValidateListInstance;
|
||||
/**
|
||||
* Remove a SinkInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a SinkInstance 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 SinkInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
/**
|
||||
* Fetch a SinkInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
/**
|
||||
* Update a SinkInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance
|
||||
*/
|
||||
update(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
/**
|
||||
* Update a SinkInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface SinkContextSolution {
|
||||
sid: string;
|
||||
}
|
||||
export declare class SinkContextImpl implements SinkContext {
|
||||
protected _version: V1;
|
||||
protected _solution: SinkContextSolution;
|
||||
protected _uri: string;
|
||||
protected _sinkTest?: SinkTestListInstance;
|
||||
protected _sinkValidate?: SinkValidateListInstance;
|
||||
constructor(_version: V1, sid: string);
|
||||
get sinkTest(): SinkTestListInstance;
|
||||
get sinkValidate(): SinkValidateListInstance;
|
||||
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?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
update(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
updateWithHttpInfo(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): SinkContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface SinkPayload extends TwilioResponsePayload {
|
||||
sinks: SinkResource[];
|
||||
}
|
||||
interface SinkResource {
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
description: string;
|
||||
sid: string;
|
||||
sink_configuration: any;
|
||||
sink_type: SinkSinkType;
|
||||
status: SinkStatus;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class SinkInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: SinkContextSolution;
|
||||
protected _context?: SinkContext;
|
||||
constructor(_version: V1, payload: SinkResource, sid?: string);
|
||||
/**
|
||||
* The date that this Sink was created, given in ISO 8601 format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date that this Sink was updated, given in ISO 8601 format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* A human readable description for the Sink
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* A 34 character string that uniquely identifies this Sink.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The information required for Twilio to connect to the provided Sink encoded as JSON.
|
||||
*/
|
||||
sinkConfiguration: any;
|
||||
sinkType: SinkSinkType;
|
||||
status: SinkStatus;
|
||||
/**
|
||||
* The URL of this resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Contains a dictionary of URL links to nested resources of this Sink.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a SinkInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a SinkInstance 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 SinkInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
/**
|
||||
* Fetch a SinkInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
/**
|
||||
* Update a SinkInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance
|
||||
*/
|
||||
update(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
/**
|
||||
* Update a SinkInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
/**
|
||||
* Access the sinkTest.
|
||||
*/
|
||||
sinkTest(): SinkTestListInstance;
|
||||
/**
|
||||
* Access the sinkValidate.
|
||||
*/
|
||||
sinkValidate(): SinkValidateListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
description: string;
|
||||
sid: string;
|
||||
sinkConfiguration: any;
|
||||
sinkType: SinkSinkType;
|
||||
status: SinkStatus;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface SinkSolution {
|
||||
}
|
||||
export interface SinkListInstance {
|
||||
_version: V1;
|
||||
_solution: SinkSolution;
|
||||
_uri: string;
|
||||
(sid: string): SinkContext;
|
||||
get(sid: string): SinkContext;
|
||||
/**
|
||||
* Create a SinkInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance
|
||||
*/
|
||||
create(params: SinkListInstanceCreateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>;
|
||||
/**
|
||||
* Create a SinkInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: SinkListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SinkInstance>) => any): Promise<ApiResponse<SinkInstance>>;
|
||||
/**
|
||||
* Streams SinkInstance 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 { SinkListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: SinkInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: SinkListInstanceEachOptions, callback?: (item: SinkInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams SinkInstance 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 { SinkListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: SinkInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: SinkListInstanceEachOptions, callback?: (item: SinkInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of SinkInstance 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: SinkPage) => any): Promise<SinkPage>;
|
||||
/**
|
||||
* Retrieve a single target page of SinkInstance 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<SinkPage>) => any): Promise<ApiResponse<SinkPage>>;
|
||||
/**
|
||||
* Lists SinkInstance 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 { SinkListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: SinkInstance[]) => any): Promise<SinkInstance[]>;
|
||||
list(params: SinkListInstanceOptions, callback?: (error: Error | null, items: SinkInstance[]) => any): Promise<SinkInstance[]>;
|
||||
/**
|
||||
* Lists SinkInstance 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 { SinkListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SinkInstance[]>) => any): Promise<ApiResponse<SinkInstance[]>>;
|
||||
listWithHttpInfo(params: SinkListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SinkInstance[]>) => any): Promise<ApiResponse<SinkInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of SinkInstance 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 { SinkListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: SinkPage) => any): Promise<SinkPage>;
|
||||
page(params: SinkListInstancePageOptions, callback?: (error: Error | null, items: SinkPage) => any): Promise<SinkPage>;
|
||||
/**
|
||||
* Retrieve a single page of SinkInstance 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 { SinkListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SinkPage>) => any): Promise<ApiResponse<SinkPage>>;
|
||||
pageWithHttpInfo(params: SinkListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SinkPage>) => any): Promise<ApiResponse<SinkPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SinkListInstance(version: V1): SinkListInstance;
|
||||
export declare class SinkPage extends Page<V1, SinkPayload, SinkResource, SinkInstance> {
|
||||
/**
|
||||
* Initialize the SinkPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: SinkSolution);
|
||||
/**
|
||||
* Build an instance of SinkInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: SinkResource): SinkInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
471
node_modules/twilio/lib/rest/events/v1/sink.js
generated
vendored
Normal file
471
node_modules/twilio/lib/rest/events/v1/sink.js
generated
vendored
Normal file
@@ -0,0 +1,471 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SinkPage = exports.SinkInstance = exports.SinkContextImpl = void 0;
|
||||
exports.SinkListInstance = SinkListInstance;
|
||||
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 sinkTest_1 = require("./sink/sinkTest");
|
||||
const sinkValidate_1 = require("./sink/sinkValidate");
|
||||
class SinkContextImpl {
|
||||
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 = `/Sinks/${sid}`;
|
||||
}
|
||||
get sinkTest() {
|
||||
this._sinkTest =
|
||||
this._sinkTest || (0, sinkTest_1.SinkTestListInstance)(this._version, this._solution.sid);
|
||||
return this._sinkTest;
|
||||
}
|
||||
get sinkValidate() {
|
||||
this._sinkValidate =
|
||||
this._sinkValidate ||
|
||||
(0, sinkValidate_1.SinkValidateListInstance)(this._version, this._solution.sid);
|
||||
return this._sinkValidate;
|
||||
}
|
||||
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 SinkInstance(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 SinkInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["description"] === null || params["description"] === undefined) {
|
||||
throw new Error("Required parameter \"params['description']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Description"] = params["description"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SinkInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["description"] === null || params["description"] === undefined) {
|
||||
throw new Error("Required parameter \"params['description']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Description"] = params["description"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.updateWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SinkInstance(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.SinkContextImpl = SinkContextImpl;
|
||||
class SinkInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.description = payload.description;
|
||||
this.sid = payload.sid;
|
||||
this.sinkConfiguration = payload.sink_configuration;
|
||||
this.sinkType = payload.sink_type;
|
||||
this.status = payload.status;
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context || new SinkContextImpl(this._version, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a SinkInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a SinkInstance 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 SinkInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a SinkInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkInstance 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 sinkTest.
|
||||
*/
|
||||
sinkTest() {
|
||||
return this._proxy.sinkTest;
|
||||
}
|
||||
/**
|
||||
* Access the sinkValidate.
|
||||
*/
|
||||
sinkValidate() {
|
||||
return this._proxy.sinkValidate;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
description: this.description,
|
||||
sid: this.sid,
|
||||
sinkConfiguration: this.sinkConfiguration,
|
||||
sinkType: this.sinkType,
|
||||
status: this.status,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SinkInstance = SinkInstance;
|
||||
function SinkListInstance(version) {
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new SinkContextImpl(version, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/Sinks`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["description"] === null || params["description"] === undefined) {
|
||||
throw new Error("Required parameter \"params['description']\" missing.");
|
||||
}
|
||||
if (params["sinkConfiguration"] === null ||
|
||||
params["sinkConfiguration"] === undefined) {
|
||||
throw new Error("Required parameter \"params['sinkConfiguration']\" missing.");
|
||||
}
|
||||
if (params["sinkType"] === null || params["sinkType"] === undefined) {
|
||||
throw new Error("Required parameter \"params['sinkType']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Description"] = params["description"];
|
||||
data["SinkConfiguration"] = serialize.object(params["sinkConfiguration"]);
|
||||
data["SinkType"] = params["sinkType"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SinkInstance(operationVersion, payload));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["description"] === null || params["description"] === undefined) {
|
||||
throw new Error("Required parameter \"params['description']\" missing.");
|
||||
}
|
||||
if (params["sinkConfiguration"] === null ||
|
||||
params["sinkConfiguration"] === undefined) {
|
||||
throw new Error("Required parameter \"params['sinkConfiguration']\" missing.");
|
||||
}
|
||||
if (params["sinkType"] === null || params["sinkType"] === undefined) {
|
||||
throw new Error("Required parameter \"params['sinkType']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Description"] = params["description"];
|
||||
data["SinkConfiguration"] = serialize.object(params["sinkConfiguration"]);
|
||||
data["SinkType"] = params["sinkType"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SinkInstance(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["inUse"] !== undefined)
|
||||
data["InUse"] = serialize.bool(params["inUse"]);
|
||||
if (params["status"] !== undefined)
|
||||
data["Status"] = params["status"];
|
||||
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 SinkPage(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 SinkPage(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["inUse"] !== undefined)
|
||||
data["InUse"] = serialize.bool(params["inUse"]);
|
||||
if (params["status"] !== undefined)
|
||||
data["Status"] = params["status"];
|
||||
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 SinkPage(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 SinkPage(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 SinkPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the SinkPage
|
||||
*
|
||||
* @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 SinkInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new SinkInstance(this._version, payload);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SinkPage = SinkPage;
|
||||
54
node_modules/twilio/lib/rest/events/v1/sink/sinkTest.d.ts
generated
vendored
Normal file
54
node_modules/twilio/lib/rest/events/v1/sink/sinkTest.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../../V1";
|
||||
import { ApiResponse } from "../../../../base/ApiResponse";
|
||||
export interface SinkTestSolution {
|
||||
sid: string;
|
||||
}
|
||||
export interface SinkTestListInstance {
|
||||
_version: V1;
|
||||
_solution: SinkTestSolution;
|
||||
_uri: string;
|
||||
/**
|
||||
* Create a SinkTestInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkTestInstance
|
||||
*/
|
||||
create(callback?: (error: Error | null, item?: SinkTestInstance) => any): Promise<SinkTestInstance>;
|
||||
/**
|
||||
* Create a SinkTestInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkTestInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SinkTestInstance>) => any): Promise<ApiResponse<SinkTestInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SinkTestListInstance(version: V1, sid: string): SinkTestListInstance;
|
||||
interface SinkTestResource {
|
||||
result: string;
|
||||
}
|
||||
export declare class SinkTestInstance {
|
||||
protected _version: V1;
|
||||
constructor(_version: V1, payload: SinkTestResource, sid: string);
|
||||
/**
|
||||
* Feedback indicating whether the test event was generated.
|
||||
*/
|
||||
result: string;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
result: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
87
node_modules/twilio/lib/rest/events/v1/sink/sinkTest.js
generated
vendored
Normal file
87
node_modules/twilio/lib/rest/events/v1/sink/sinkTest.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SinkTestInstance = void 0;
|
||||
exports.SinkTestListInstance = SinkTestListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../../base/deserialize");
|
||||
const serialize = require("../../../../base/serialize");
|
||||
const utility_1 = require("../../../../base/utility");
|
||||
function SinkTestListInstance(version, sid) {
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
const instance = {};
|
||||
instance._version = version;
|
||||
instance._solution = { sid };
|
||||
instance._uri = `/Sinks/${sid}/Test`;
|
||||
instance.create = function create(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SinkTestInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SinkTestInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
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 SinkTestInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.result = payload.result;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
result: this.result,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SinkTestInstance = SinkTestInstance;
|
||||
63
node_modules/twilio/lib/rest/events/v1/sink/sinkValidate.d.ts
generated
vendored
Normal file
63
node_modules/twilio/lib/rest/events/v1/sink/sinkValidate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../../V1";
|
||||
import { ApiResponse } from "../../../../base/ApiResponse";
|
||||
/**
|
||||
* Options to pass to create a SinkValidateInstance
|
||||
*/
|
||||
export interface SinkValidateListInstanceCreateOptions {
|
||||
/** A 34 character string that uniquely identifies the test event for a Sink being validated. */
|
||||
testId: string;
|
||||
}
|
||||
export interface SinkValidateSolution {
|
||||
sid: string;
|
||||
}
|
||||
export interface SinkValidateListInstance {
|
||||
_version: V1;
|
||||
_solution: SinkValidateSolution;
|
||||
_uri: string;
|
||||
/**
|
||||
* Create a SinkValidateInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkValidateInstance
|
||||
*/
|
||||
create(params: SinkValidateListInstanceCreateOptions, callback?: (error: Error | null, item?: SinkValidateInstance) => any): Promise<SinkValidateInstance>;
|
||||
/**
|
||||
* Create a SinkValidateInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SinkValidateInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: SinkValidateListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SinkValidateInstance>) => any): Promise<ApiResponse<SinkValidateInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SinkValidateListInstance(version: V1, sid: string): SinkValidateListInstance;
|
||||
interface SinkValidateResource {
|
||||
result: string;
|
||||
}
|
||||
export declare class SinkValidateInstance {
|
||||
protected _version: V1;
|
||||
constructor(_version: V1, payload: SinkValidateResource, sid: string);
|
||||
/**
|
||||
* Feedback indicating whether the given Sink was validated.
|
||||
*/
|
||||
result: string;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
result: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
107
node_modules/twilio/lib/rest/events/v1/sink/sinkValidate.js
generated
vendored
Normal file
107
node_modules/twilio/lib/rest/events/v1/sink/sinkValidate.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SinkValidateInstance = void 0;
|
||||
exports.SinkValidateListInstance = SinkValidateListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../../base/deserialize");
|
||||
const serialize = require("../../../../base/serialize");
|
||||
const utility_1 = require("../../../../base/utility");
|
||||
function SinkValidateListInstance(version, sid) {
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
const instance = {};
|
||||
instance._version = version;
|
||||
instance._solution = { sid };
|
||||
instance._uri = `/Sinks/${sid}/Validate`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["testId"] === null || params["testId"] === undefined) {
|
||||
throw new Error("Required parameter \"params['testId']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["TestId"] = params["testId"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SinkValidateInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["testId"] === null || params["testId"] === undefined) {
|
||||
throw new Error("Required parameter \"params['testId']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["TestId"] = params["testId"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SinkValidateInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
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 SinkValidateInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.result = payload.result;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
result: this.result,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SinkValidateInstance = SinkValidateInstance;
|
||||
452
node_modules/twilio/lib/rest/events/v1/subscription.d.ts
generated
vendored
Normal file
452
node_modules/twilio/lib/rest/events/v1/subscription.d.ts
generated
vendored
Normal file
@@ -0,0 +1,452 @@
|
||||
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 { SubscribedEventListInstance } from "./subscription/subscribedEvent";
|
||||
/**
|
||||
* Options to pass to update a SubscriptionInstance
|
||||
*/
|
||||
export interface SubscriptionContextUpdateOptions {
|
||||
/** A human readable description for the Subscription. */
|
||||
description?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a SubscriptionInstance
|
||||
*/
|
||||
export interface SubscriptionListInstanceCreateOptions {
|
||||
/** A human readable description for the Subscription **This value should not contain PII.** */
|
||||
description: string;
|
||||
/** The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. */
|
||||
sinkSid: string;
|
||||
/** An array of objects containing the subscribed Event Types */
|
||||
types: Array<any>;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface SubscriptionListInstanceEachOptions {
|
||||
/** The SID of the sink that the list of Subscriptions should be filtered by. */
|
||||
sinkSid?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: SubscriptionInstance, 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 SubscriptionListInstanceOptions {
|
||||
/** The SID of the sink that the list of Subscriptions should be filtered by. */
|
||||
sinkSid?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to page
|
||||
*/
|
||||
export interface SubscriptionListInstancePageOptions {
|
||||
/** The SID of the sink that the list of Subscriptions should be filtered by. */
|
||||
sinkSid?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface SubscriptionContext {
|
||||
subscribedEvents: SubscribedEventListInstance;
|
||||
/**
|
||||
* Remove a SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a SubscriptionInstance 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 SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Fetch a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Update a SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Update a SubscriptionInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
update(params: SubscriptionContextUpdateOptions, callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Update a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Update a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: SubscriptionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface SubscriptionContextSolution {
|
||||
sid: string;
|
||||
}
|
||||
export declare class SubscriptionContextImpl implements SubscriptionContext {
|
||||
protected _version: V1;
|
||||
protected _solution: SubscriptionContextSolution;
|
||||
protected _uri: string;
|
||||
protected _subscribedEvents?: SubscribedEventListInstance;
|
||||
constructor(_version: V1, sid: string);
|
||||
get subscribedEvents(): SubscribedEventListInstance;
|
||||
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?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
update(params?: SubscriptionContextUpdateOptions | ((error: Error | null, item?: SubscriptionInstance) => any), callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
updateWithHttpInfo(params?: SubscriptionContextUpdateOptions | ((error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): SubscriptionContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface SubscriptionPayload extends TwilioResponsePayload {
|
||||
subscriptions: SubscriptionResource[];
|
||||
}
|
||||
interface SubscriptionResource {
|
||||
account_sid: string;
|
||||
sid: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
description: string;
|
||||
sink_sid: string;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class SubscriptionInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: SubscriptionContextSolution;
|
||||
protected _context?: SubscriptionContext;
|
||||
constructor(_version: V1, payload: SubscriptionResource, sid?: string);
|
||||
/**
|
||||
* The unique SID identifier of the Account.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* A 34 character string that uniquely identifies this Subscription.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The date that this Subscription was created, given in ISO 8601 format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date that this Subscription was updated, given in ISO 8601 format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* A human readable description for the Subscription
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created.
|
||||
*/
|
||||
sinkSid: string;
|
||||
/**
|
||||
* The URL of this resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Contains a dictionary of URL links to nested resources of this Subscription.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a SubscriptionInstance 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 SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Fetch a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Update a SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Update a SubscriptionInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
update(params: SubscriptionContextUpdateOptions, callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Update a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Update a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: SubscriptionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Access the subscribedEvents.
|
||||
*/
|
||||
subscribedEvents(): SubscribedEventListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
accountSid: string;
|
||||
sid: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
description: string;
|
||||
sinkSid: string;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface SubscriptionSolution {
|
||||
}
|
||||
export interface SubscriptionListInstance {
|
||||
_version: V1;
|
||||
_solution: SubscriptionSolution;
|
||||
_uri: string;
|
||||
(sid: string): SubscriptionContext;
|
||||
get(sid: string): SubscriptionContext;
|
||||
/**
|
||||
* Create a SubscriptionInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
create(params: SubscriptionListInstanceCreateOptions, callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>;
|
||||
/**
|
||||
* Create a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: SubscriptionListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SubscriptionInstance>) => any): Promise<ApiResponse<SubscriptionInstance>>;
|
||||
/**
|
||||
* Streams SubscriptionInstance 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 { SubscriptionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: SubscriptionInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: SubscriptionListInstanceEachOptions, callback?: (item: SubscriptionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams SubscriptionInstance 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 { SubscriptionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: SubscriptionInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: SubscriptionListInstanceEachOptions, callback?: (item: SubscriptionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of SubscriptionInstance 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: SubscriptionPage) => any): Promise<SubscriptionPage>;
|
||||
/**
|
||||
* Retrieve a single target page of SubscriptionInstance 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<SubscriptionPage>) => any): Promise<ApiResponse<SubscriptionPage>>;
|
||||
/**
|
||||
* Lists SubscriptionInstance 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 { SubscriptionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: SubscriptionInstance[]) => any): Promise<SubscriptionInstance[]>;
|
||||
list(params: SubscriptionListInstanceOptions, callback?: (error: Error | null, items: SubscriptionInstance[]) => any): Promise<SubscriptionInstance[]>;
|
||||
/**
|
||||
* Lists SubscriptionInstance 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 { SubscriptionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SubscriptionInstance[]>) => any): Promise<ApiResponse<SubscriptionInstance[]>>;
|
||||
listWithHttpInfo(params: SubscriptionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SubscriptionInstance[]>) => any): Promise<ApiResponse<SubscriptionInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of SubscriptionInstance 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 { SubscriptionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: SubscriptionPage) => any): Promise<SubscriptionPage>;
|
||||
page(params: SubscriptionListInstancePageOptions, callback?: (error: Error | null, items: SubscriptionPage) => any): Promise<SubscriptionPage>;
|
||||
/**
|
||||
* Retrieve a single page of SubscriptionInstance 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 { SubscriptionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SubscriptionPage>) => any): Promise<ApiResponse<SubscriptionPage>>;
|
||||
pageWithHttpInfo(params: SubscriptionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SubscriptionPage>) => any): Promise<ApiResponse<SubscriptionPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SubscriptionListInstance(version: V1): SubscriptionListInstance;
|
||||
export declare class SubscriptionPage extends Page<V1, SubscriptionPayload, SubscriptionResource, SubscriptionInstance> {
|
||||
/**
|
||||
* Initialize the SubscriptionPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: SubscriptionSolution);
|
||||
/**
|
||||
* Build an instance of SubscriptionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: SubscriptionResource): SubscriptionInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
456
node_modules/twilio/lib/rest/events/v1/subscription.js
generated
vendored
Normal file
456
node_modules/twilio/lib/rest/events/v1/subscription.js
generated
vendored
Normal file
@@ -0,0 +1,456 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SubscriptionPage = exports.SubscriptionInstance = exports.SubscriptionContextImpl = void 0;
|
||||
exports.SubscriptionListInstance = SubscriptionListInstance;
|
||||
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 subscribedEvent_1 = require("./subscription/subscribedEvent");
|
||||
class SubscriptionContextImpl {
|
||||
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 = `/Subscriptions/${sid}`;
|
||||
}
|
||||
get subscribedEvents() {
|
||||
this._subscribedEvents =
|
||||
this._subscribedEvents ||
|
||||
(0, subscribedEvent_1.SubscribedEventListInstance)(this._version, this._solution.sid);
|
||||
return this._subscribedEvents;
|
||||
}
|
||||
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 SubscriptionInstance(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 SubscriptionInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["description"] !== undefined)
|
||||
data["Description"] = params["description"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SubscriptionInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["description"] !== undefined)
|
||||
data["Description"] = params["description"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.updateWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SubscriptionInstance(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.SubscriptionContextImpl = SubscriptionContextImpl;
|
||||
class SubscriptionInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.sid = payload.sid;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.description = payload.description;
|
||||
this.sinkSid = payload.sink_sid;
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new SubscriptionContextImpl(this._version, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a SubscriptionInstance 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 SubscriptionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a SubscriptionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscriptionInstance 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 subscribedEvents.
|
||||
*/
|
||||
subscribedEvents() {
|
||||
return this._proxy.subscribedEvents;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
accountSid: this.accountSid,
|
||||
sid: this.sid,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
description: this.description,
|
||||
sinkSid: this.sinkSid,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SubscriptionInstance = SubscriptionInstance;
|
||||
function SubscriptionListInstance(version) {
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new SubscriptionContextImpl(version, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/Subscriptions`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["description"] === null || params["description"] === undefined) {
|
||||
throw new Error("Required parameter \"params['description']\" missing.");
|
||||
}
|
||||
if (params["sinkSid"] === null || params["sinkSid"] === undefined) {
|
||||
throw new Error("Required parameter \"params['sinkSid']\" missing.");
|
||||
}
|
||||
if (params["types"] === null || params["types"] === undefined) {
|
||||
throw new Error("Required parameter \"params['types']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Description"] = params["description"];
|
||||
data["SinkSid"] = params["sinkSid"];
|
||||
data["Types"] = serialize.map(params["types"], (e) => serialize.object(e));
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SubscriptionInstance(operationVersion, payload));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["description"] === null || params["description"] === undefined) {
|
||||
throw new Error("Required parameter \"params['description']\" missing.");
|
||||
}
|
||||
if (params["sinkSid"] === null || params["sinkSid"] === undefined) {
|
||||
throw new Error("Required parameter \"params['sinkSid']\" missing.");
|
||||
}
|
||||
if (params["types"] === null || params["types"] === undefined) {
|
||||
throw new Error("Required parameter \"params['types']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Description"] = params["description"];
|
||||
data["SinkSid"] = params["sinkSid"];
|
||||
data["Types"] = serialize.map(params["types"], (e) => serialize.object(e));
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SubscriptionInstance(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["sinkSid"] !== undefined)
|
||||
data["SinkSid"] = params["sinkSid"];
|
||||
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 SubscriptionPage(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 SubscriptionPage(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["sinkSid"] !== undefined)
|
||||
data["SinkSid"] = params["sinkSid"];
|
||||
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 SubscriptionPage(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 SubscriptionPage(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 SubscriptionPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the SubscriptionPage
|
||||
*
|
||||
* @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 SubscriptionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new SubscriptionInstance(this._version, payload);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SubscriptionPage = SubscriptionPage;
|
||||
420
node_modules/twilio/lib/rest/events/v1/subscription/subscribedEvent.d.ts
generated
vendored
Normal file
420
node_modules/twilio/lib/rest/events/v1/subscription/subscribedEvent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,420 @@
|
||||
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 update a SubscribedEventInstance
|
||||
*/
|
||||
export interface SubscribedEventContextUpdateOptions {
|
||||
/** The schema version that the Subscription should use. */
|
||||
schemaVersion?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a SubscribedEventInstance
|
||||
*/
|
||||
export interface SubscribedEventListInstanceCreateOptions {
|
||||
/** Type of event being subscribed to. */
|
||||
type: string;
|
||||
/** The schema version that the Subscription should use. */
|
||||
schemaVersion?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface SubscribedEventListInstanceEachOptions {
|
||||
/** 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: SubscribedEventInstance, 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 SubscribedEventListInstanceOptions {
|
||||
/** 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 SubscribedEventListInstancePageOptions {
|
||||
/** 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 SubscribedEventContext {
|
||||
/**
|
||||
* Remove a SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a SubscribedEventInstance 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 SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Fetch a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
update(params: SubscribedEventContextUpdateOptions, callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: SubscribedEventContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface SubscribedEventContextSolution {
|
||||
subscriptionSid: string;
|
||||
type: string;
|
||||
}
|
||||
export declare class SubscribedEventContextImpl implements SubscribedEventContext {
|
||||
protected _version: V1;
|
||||
protected _solution: SubscribedEventContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, subscriptionSid: string, type: string);
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
update(params?: SubscribedEventContextUpdateOptions | ((error: Error | null, item?: SubscribedEventInstance) => any), callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
updateWithHttpInfo(params?: SubscribedEventContextUpdateOptions | ((error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): SubscribedEventContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface SubscribedEventPayload extends TwilioResponsePayload {
|
||||
types: SubscribedEventResource[];
|
||||
}
|
||||
interface SubscribedEventResource {
|
||||
account_sid: string;
|
||||
type: string;
|
||||
schema_version: number;
|
||||
subscription_sid: string;
|
||||
url: string;
|
||||
}
|
||||
export declare class SubscribedEventInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: SubscribedEventContextSolution;
|
||||
protected _context?: SubscribedEventContext;
|
||||
constructor(_version: V1, payload: SubscribedEventResource, subscriptionSid: string, type?: string);
|
||||
/**
|
||||
* The unique SID identifier of the Account.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* Type of event being subscribed to.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The schema version that the Subscription should use.
|
||||
*/
|
||||
schemaVersion: number;
|
||||
/**
|
||||
* The unique SID identifier of the Subscription.
|
||||
*/
|
||||
subscriptionSid: string;
|
||||
/**
|
||||
* The URL of this resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a SubscribedEventInstance 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 SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Fetch a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
update(params: SubscribedEventContextUpdateOptions, callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Update a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: SubscribedEventContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
accountSid: string;
|
||||
type: string;
|
||||
schemaVersion: number;
|
||||
subscriptionSid: string;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface SubscribedEventSolution {
|
||||
subscriptionSid: string;
|
||||
}
|
||||
export interface SubscribedEventListInstance {
|
||||
_version: V1;
|
||||
_solution: SubscribedEventSolution;
|
||||
_uri: string;
|
||||
(type: string): SubscribedEventContext;
|
||||
get(type: string): SubscribedEventContext;
|
||||
/**
|
||||
* Create a SubscribedEventInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
create(params: SubscribedEventListInstanceCreateOptions, callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>;
|
||||
/**
|
||||
* Create a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: SubscribedEventListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SubscribedEventInstance>) => any): Promise<ApiResponse<SubscribedEventInstance>>;
|
||||
/**
|
||||
* Streams SubscribedEventInstance 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 { SubscribedEventListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: SubscribedEventInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: SubscribedEventListInstanceEachOptions, callback?: (item: SubscribedEventInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams SubscribedEventInstance 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 { SubscribedEventListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: SubscribedEventInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: SubscribedEventListInstanceEachOptions, callback?: (item: SubscribedEventInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of SubscribedEventInstance 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: SubscribedEventPage) => any): Promise<SubscribedEventPage>;
|
||||
/**
|
||||
* Retrieve a single target page of SubscribedEventInstance 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<SubscribedEventPage>) => any): Promise<ApiResponse<SubscribedEventPage>>;
|
||||
/**
|
||||
* Lists SubscribedEventInstance 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 { SubscribedEventListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: SubscribedEventInstance[]) => any): Promise<SubscribedEventInstance[]>;
|
||||
list(params: SubscribedEventListInstanceOptions, callback?: (error: Error | null, items: SubscribedEventInstance[]) => any): Promise<SubscribedEventInstance[]>;
|
||||
/**
|
||||
* Lists SubscribedEventInstance 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 { SubscribedEventListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SubscribedEventInstance[]>) => any): Promise<ApiResponse<SubscribedEventInstance[]>>;
|
||||
listWithHttpInfo(params: SubscribedEventListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SubscribedEventInstance[]>) => any): Promise<ApiResponse<SubscribedEventInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of SubscribedEventInstance 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 { SubscribedEventListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: SubscribedEventPage) => any): Promise<SubscribedEventPage>;
|
||||
page(params: SubscribedEventListInstancePageOptions, callback?: (error: Error | null, items: SubscribedEventPage) => any): Promise<SubscribedEventPage>;
|
||||
/**
|
||||
* Retrieve a single page of SubscribedEventInstance 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 { SubscribedEventListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SubscribedEventPage>) => any): Promise<ApiResponse<SubscribedEventPage>>;
|
||||
pageWithHttpInfo(params: SubscribedEventListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SubscribedEventPage>) => any): Promise<ApiResponse<SubscribedEventPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function SubscribedEventListInstance(version: V1, subscriptionSid: string): SubscribedEventListInstance;
|
||||
export declare class SubscribedEventPage extends Page<V1, SubscribedEventPayload, SubscribedEventResource, SubscribedEventInstance> {
|
||||
/**
|
||||
* Initialize the SubscribedEventPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: SubscribedEventSolution);
|
||||
/**
|
||||
* Build an instance of SubscribedEventInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: SubscribedEventResource): SubscribedEventInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
427
node_modules/twilio/lib/rest/events/v1/subscription/subscribedEvent.js
generated
vendored
Normal file
427
node_modules/twilio/lib/rest/events/v1/subscription/subscribedEvent.js
generated
vendored
Normal file
@@ -0,0 +1,427 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Events
|
||||
* 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.SubscribedEventPage = exports.SubscribedEventInstance = exports.SubscribedEventContextImpl = void 0;
|
||||
exports.SubscribedEventListInstance = SubscribedEventListInstance;
|
||||
const util_1 = require("util");
|
||||
const Page_1 = __importDefault(require("../../../../base/Page"));
|
||||
const deserialize = require("../../../../base/deserialize");
|
||||
const serialize = require("../../../../base/serialize");
|
||||
const utility_1 = require("../../../../base/utility");
|
||||
class SubscribedEventContextImpl {
|
||||
constructor(_version, subscriptionSid, type) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(subscriptionSid)) {
|
||||
throw new Error("Parameter 'subscriptionSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(type)) {
|
||||
throw new Error("Parameter 'type' is not valid.");
|
||||
}
|
||||
this._solution = { subscriptionSid, type };
|
||||
this._uri = `/Subscriptions/${subscriptionSid}/SubscribedEvents/${type}`;
|
||||
}
|
||||
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 SubscribedEventInstance(operationVersion, payload, instance._solution.subscriptionSid, instance._solution.type));
|
||||
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 SubscribedEventInstance(operationVersion, response.body, instance._solution.subscriptionSid, instance._solution.type),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["schemaVersion"] !== undefined)
|
||||
data["SchemaVersion"] = params["schemaVersion"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SubscribedEventInstance(operationVersion, payload, instance._solution.subscriptionSid, instance._solution.type));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["schemaVersion"] !== undefined)
|
||||
data["SchemaVersion"] = params["schemaVersion"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.updateWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SubscribedEventInstance(operationVersion, response.body, instance._solution.subscriptionSid, instance._solution.type),
|
||||
}));
|
||||
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.SubscribedEventContextImpl = SubscribedEventContextImpl;
|
||||
class SubscribedEventInstance {
|
||||
constructor(_version, payload, subscriptionSid, type) {
|
||||
this._version = _version;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.type = payload.type;
|
||||
this.schemaVersion = deserialize.integer(payload.schema_version);
|
||||
this.subscriptionSid = payload.subscription_sid;
|
||||
this.url = payload.url;
|
||||
this._solution = { subscriptionSid, type: type || this.type };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new SubscribedEventContextImpl(this._version, this._solution.subscriptionSid, this._solution.type);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a SubscribedEventInstance 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 SubscribedEventInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a SubscribedEventInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed SubscribedEventInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
update(params, callback) {
|
||||
return this._proxy.update(params, callback);
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
return this._proxy.updateWithHttpInfo(params, callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
accountSid: this.accountSid,
|
||||
type: this.type,
|
||||
schemaVersion: this.schemaVersion,
|
||||
subscriptionSid: this.subscriptionSid,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SubscribedEventInstance = SubscribedEventInstance;
|
||||
function SubscribedEventListInstance(version, subscriptionSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(subscriptionSid)) {
|
||||
throw new Error("Parameter 'subscriptionSid' is not valid.");
|
||||
}
|
||||
const instance = ((type) => instance.get(type));
|
||||
instance.get = function get(type) {
|
||||
return new SubscribedEventContextImpl(version, subscriptionSid, type);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { subscriptionSid };
|
||||
instance._uri = `/Subscriptions/${subscriptionSid}/SubscribedEvents`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["type"] === null || params["type"] === undefined) {
|
||||
throw new Error("Required parameter \"params['type']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Type"] = params["type"];
|
||||
if (params["schemaVersion"] !== undefined)
|
||||
data["SchemaVersion"] = params["schemaVersion"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new SubscribedEventInstance(operationVersion, payload, instance._solution.subscriptionSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["type"] === null || params["type"] === undefined) {
|
||||
throw new Error("Required parameter \"params['type']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Type"] = params["type"];
|
||||
if (params["schemaVersion"] !== undefined)
|
||||
data["SchemaVersion"] = params["schemaVersion"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new SubscribedEventInstance(operationVersion, response.body, instance._solution.subscriptionSid),
|
||||
}));
|
||||
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 SubscribedEventPage(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 SubscribedEventPage(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 SubscribedEventPage(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 SubscribedEventPage(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 SubscribedEventPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the SubscribedEventPage
|
||||
*
|
||||
* @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 SubscribedEventInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new SubscribedEventInstance(this._version, payload, this._solution.subscriptionSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.SubscribedEventPage = SubscribedEventPage;
|
||||
Reference in New Issue
Block a user