Auto-commit 2026-04-29 16:31
This commit is contained in:
15
node_modules/twilio/lib/rest/serverless/V1.d.ts
generated
vendored
Normal file
15
node_modules/twilio/lib/rest/serverless/V1.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import ServerlessBase from "../ServerlessBase";
|
||||
import Version from "../../base/Version";
|
||||
import { ServiceListInstance } from "./v1/service";
|
||||
export default class V1 extends Version {
|
||||
/**
|
||||
* Initialize the V1 version of Serverless
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.Serverless) domain
|
||||
*/
|
||||
constructor(domain: ServerlessBase);
|
||||
/** services - { Twilio.Serverless.V1.ServiceListInstance } resource */
|
||||
protected _services?: ServiceListInstance;
|
||||
/** Getter for services resource */
|
||||
get services(): ServiceListInstance;
|
||||
}
|
||||
36
node_modules/twilio/lib/rest/serverless/V1.js
generated
vendored
Normal file
36
node_modules/twilio/lib/rest/serverless/V1.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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 service_1 = require("./v1/service");
|
||||
class V1 extends Version_1.default {
|
||||
/**
|
||||
* Initialize the V1 version of Serverless
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.Serverless) domain
|
||||
*/
|
||||
constructor(domain) {
|
||||
super(domain, "v1");
|
||||
}
|
||||
/** Getter for services resource */
|
||||
get services() {
|
||||
this._services = this._services || (0, service_1.ServiceListInstance)(this);
|
||||
return this._services;
|
||||
}
|
||||
}
|
||||
exports.default = V1;
|
||||
494
node_modules/twilio/lib/rest/serverless/v1/service.d.ts
generated
vendored
Normal file
494
node_modules/twilio/lib/rest/serverless/v1/service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,494 @@
|
||||
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 { AssetListInstance } from "./service/asset";
|
||||
import { BuildListInstance } from "./service/build";
|
||||
import { EnvironmentListInstance } from "./service/environment";
|
||||
import { FunctionListInstance } from "./service/function";
|
||||
/**
|
||||
* Options to pass to update a ServiceInstance
|
||||
*/
|
||||
export interface ServiceContextUpdateOptions {
|
||||
/** Whether to inject Account credentials into a function invocation context. */
|
||||
includeCredentials?: boolean;
|
||||
/** A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. */
|
||||
friendlyName?: string;
|
||||
/** Whether the Service resource\\\'s properties and subresources can be edited via the UI. The default value is `false`. */
|
||||
uiEditable?: boolean;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a ServiceInstance
|
||||
*/
|
||||
export interface ServiceListInstanceCreateOptions {
|
||||
/** A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the `sid` in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique. */
|
||||
uniqueName: string;
|
||||
/** A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. */
|
||||
friendlyName: string;
|
||||
/** Whether to inject Account credentials into a function invocation context. The default value is `true`. */
|
||||
includeCredentials?: boolean;
|
||||
/** Whether the Service\\\'s properties and subresources can be edited via the UI. The default value is `false`. */
|
||||
uiEditable?: boolean;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface ServiceListInstanceEachOptions {
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: ServiceInstance, done: (err?: Error) => void) => void;
|
||||
/** Function to be called upon completion of streaming */
|
||||
done?: Function;
|
||||
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to list
|
||||
*/
|
||||
export interface ServiceListInstanceOptions {
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to page
|
||||
*/
|
||||
export interface ServiceListInstancePageOptions {
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface ServiceContext {
|
||||
assets: AssetListInstance;
|
||||
builds: BuildListInstance;
|
||||
environments: EnvironmentListInstance;
|
||||
functions: FunctionListInstance;
|
||||
/**
|
||||
* Remove a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Fetch a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Fetch a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Update a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Update a ServiceInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Update a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Update a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface ServiceContextSolution {
|
||||
sid: string;
|
||||
}
|
||||
export declare class ServiceContextImpl implements ServiceContext {
|
||||
protected _version: V1;
|
||||
protected _solution: ServiceContextSolution;
|
||||
protected _uri: string;
|
||||
protected _assets?: AssetListInstance;
|
||||
protected _builds?: BuildListInstance;
|
||||
protected _environments?: EnvironmentListInstance;
|
||||
protected _functions?: FunctionListInstance;
|
||||
constructor(_version: V1, sid: string);
|
||||
get assets(): AssetListInstance;
|
||||
get builds(): BuildListInstance;
|
||||
get environments(): EnvironmentListInstance;
|
||||
get functions(): FunctionListInstance;
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
updateWithHttpInfo(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ApiResponse<ServiceInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): ServiceContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface ServicePayload extends TwilioResponsePayload {
|
||||
services: ServiceResource[];
|
||||
}
|
||||
interface ServiceResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
friendly_name: string;
|
||||
unique_name: string;
|
||||
include_credentials: boolean;
|
||||
ui_editable: boolean;
|
||||
domain_base: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class ServiceInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: ServiceContextSolution;
|
||||
protected _context?: ServiceContext;
|
||||
constructor(_version: V1, payload: ServiceResource, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Service resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The string that you assigned to describe the Service resource.
|
||||
*/
|
||||
friendlyName: string;
|
||||
/**
|
||||
* A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource\'s `sid` in the URL to address the Service resource.
|
||||
*/
|
||||
uniqueName: string;
|
||||
/**
|
||||
* Whether to inject Account credentials into a function invocation context.
|
||||
*/
|
||||
includeCredentials: boolean;
|
||||
/**
|
||||
* Whether the Service resource\'s properties and subresources can be edited via the UI.
|
||||
*/
|
||||
uiEditable: boolean;
|
||||
/**
|
||||
* The base domain name for this Service, which is a combination of the unique name and a randomly generated string.
|
||||
*/
|
||||
domainBase: string;
|
||||
/**
|
||||
* The date and time in GMT when the Service resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Service resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The URLs of the Service\'s nested resources.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Fetch a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Fetch a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Update a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Update a ServiceInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Update a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Update a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Access the assets.
|
||||
*/
|
||||
assets(): AssetListInstance;
|
||||
/**
|
||||
* Access the builds.
|
||||
*/
|
||||
builds(): BuildListInstance;
|
||||
/**
|
||||
* Access the environments.
|
||||
*/
|
||||
environments(): EnvironmentListInstance;
|
||||
/**
|
||||
* Access the functions.
|
||||
*/
|
||||
functions(): FunctionListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
friendlyName: string;
|
||||
uniqueName: string;
|
||||
includeCredentials: boolean;
|
||||
uiEditable: boolean;
|
||||
domainBase: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface ServiceSolution {
|
||||
}
|
||||
export interface ServiceListInstance {
|
||||
_version: V1;
|
||||
_solution: ServiceSolution;
|
||||
_uri: string;
|
||||
(sid: string): ServiceContext;
|
||||
get(sid: string): ServiceContext;
|
||||
/**
|
||||
* Create a ServiceInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Create a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Streams ServiceInstance records from the API.
|
||||
*
|
||||
* This operation lazily loads records as efficiently as possible until the limit
|
||||
* is reached.
|
||||
*
|
||||
* The results are passed into the callback function, so this operation is memory
|
||||
* efficient.
|
||||
*
|
||||
* If a function is passed as the first argument, it will be used as the callback
|
||||
* function.
|
||||
*
|
||||
* @param { ServiceListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams ServiceInstance records from the API with HTTP metadata captured per page.
|
||||
*
|
||||
* This operation lazily loads records as efficiently as possible until the limit
|
||||
* is reached. HTTP metadata (status code, headers) is captured for each page request.
|
||||
*
|
||||
* The results are passed into the callback function, so this operation is memory
|
||||
* efficient.
|
||||
*
|
||||
* If a function is passed as the first argument, it will be used as the callback
|
||||
* function.
|
||||
*
|
||||
* @param { ServiceListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of ServiceInstance records from the API.
|
||||
*
|
||||
* The request is executed immediately.
|
||||
*
|
||||
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
getPage(targetUrl: string, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
|
||||
/**
|
||||
* Retrieve a single target page of ServiceInstance records from the API with HTTP metadata.
|
||||
*
|
||||
* The request is executed immediately.
|
||||
*
|
||||
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
|
||||
/**
|
||||
* Lists ServiceInstance records from the API as a list.
|
||||
*
|
||||
* If a function is passed as the first argument, it will be used as the callback
|
||||
* function.
|
||||
*
|
||||
* @param { ServiceListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>;
|
||||
list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>;
|
||||
/**
|
||||
* Lists ServiceInstance records from the API as a list with HTTP metadata.
|
||||
*
|
||||
* Returns all records along with HTTP metadata from the first page fetched.
|
||||
*
|
||||
* If a function is passed as the first argument, it will be used as the callback
|
||||
* function.
|
||||
*
|
||||
* @param { ServiceListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ServiceInstance[]>) => any): Promise<ApiResponse<ServiceInstance[]>>;
|
||||
listWithHttpInfo(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ServiceInstance[]>) => any): Promise<ApiResponse<ServiceInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of ServiceInstance records from the API.
|
||||
*
|
||||
* The request is executed immediately.
|
||||
*
|
||||
* If a function is passed as the first argument, it will be used as the callback
|
||||
* function.
|
||||
*
|
||||
* @param { ServiceListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
|
||||
page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
|
||||
/**
|
||||
* Retrieve a single page of ServiceInstance records from the API with HTTP metadata.
|
||||
*
|
||||
* The request is executed immediately.
|
||||
*
|
||||
* If a function is passed as the first argument, it will be used as the callback
|
||||
* function.
|
||||
*
|
||||
* @param { ServiceListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
|
||||
pageWithHttpInfo(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function ServiceListInstance(version: V1): ServiceListInstance;
|
||||
export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> {
|
||||
/**
|
||||
* Initialize the ServicePage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: ServiceSolution);
|
||||
/**
|
||||
* Build an instance of ServiceInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: ServiceResource): ServiceInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
505
node_modules/twilio/lib/rest/serverless/v1/service.js
generated
vendored
Normal file
505
node_modules/twilio/lib/rest/serverless/v1/service.js
generated
vendored
Normal file
@@ -0,0 +1,505 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* This is the public Twilio REST API.
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ServicePage = exports.ServiceInstance = exports.ServiceContextImpl = void 0;
|
||||
exports.ServiceListInstance = ServiceListInstance;
|
||||
const util_1 = require("util");
|
||||
const Page_1 = __importDefault(require("../../../base/Page"));
|
||||
const deserialize = require("../../../base/deserialize");
|
||||
const serialize = require("../../../base/serialize");
|
||||
const utility_1 = require("../../../base/utility");
|
||||
const asset_1 = require("./service/asset");
|
||||
const build_1 = require("./service/build");
|
||||
const environment_1 = require("./service/environment");
|
||||
const function_1 = require("./service/function");
|
||||
class ServiceContextImpl {
|
||||
constructor(_version, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { sid };
|
||||
this._uri = `/Services/${sid}`;
|
||||
}
|
||||
get assets() {
|
||||
this._assets =
|
||||
this._assets || (0, asset_1.AssetListInstance)(this._version, this._solution.sid);
|
||||
return this._assets;
|
||||
}
|
||||
get builds() {
|
||||
this._builds =
|
||||
this._builds || (0, build_1.BuildListInstance)(this._version, this._solution.sid);
|
||||
return this._builds;
|
||||
}
|
||||
get environments() {
|
||||
this._environments =
|
||||
this._environments ||
|
||||
(0, environment_1.EnvironmentListInstance)(this._version, this._solution.sid);
|
||||
return this._environments;
|
||||
}
|
||||
get functions() {
|
||||
this._functions =
|
||||
this._functions ||
|
||||
(0, function_1.FunctionListInstance)(this._version, this._solution.sid);
|
||||
return this._functions;
|
||||
}
|
||||
remove(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
||||
uri: instance._uri,
|
||||
method: "delete",
|
||||
headers,
|
||||
});
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
removeWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// DELETE operation - returns boolean based on status code
|
||||
let operationPromise = operationVersion
|
||||
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: response.statusCode === 204,
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetch(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new ServiceInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["includeCredentials"] !== undefined)
|
||||
data["IncludeCredentials"] = serialize.bool(params["includeCredentials"]);
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["uiEditable"] !== undefined)
|
||||
data["UiEditable"] = serialize.bool(params["uiEditable"]);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["includeCredentials"] !== undefined)
|
||||
data["IncludeCredentials"] = serialize.bool(params["includeCredentials"]);
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["uiEditable"] !== undefined)
|
||||
data["UiEditable"] = serialize.bool(params["uiEditable"]);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.updateWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new ServiceInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.ServiceContextImpl = ServiceContextImpl;
|
||||
class ServiceInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.friendlyName = payload.friendly_name;
|
||||
this.uniqueName = payload.unique_name;
|
||||
this.includeCredentials = payload.include_credentials;
|
||||
this.uiEditable = payload.ui_editable;
|
||||
this.domainBase = payload.domain_base;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new ServiceContextImpl(this._version, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback) {
|
||||
return this._proxy.removeWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
update(params, callback) {
|
||||
return this._proxy.update(params, callback);
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
return this._proxy.updateWithHttpInfo(params, callback);
|
||||
}
|
||||
/**
|
||||
* Access the assets.
|
||||
*/
|
||||
assets() {
|
||||
return this._proxy.assets;
|
||||
}
|
||||
/**
|
||||
* Access the builds.
|
||||
*/
|
||||
builds() {
|
||||
return this._proxy.builds;
|
||||
}
|
||||
/**
|
||||
* Access the environments.
|
||||
*/
|
||||
environments() {
|
||||
return this._proxy.environments;
|
||||
}
|
||||
/**
|
||||
* Access the functions.
|
||||
*/
|
||||
functions() {
|
||||
return this._proxy.functions;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
friendlyName: this.friendlyName,
|
||||
uniqueName: this.uniqueName,
|
||||
includeCredentials: this.includeCredentials,
|
||||
uiEditable: this.uiEditable,
|
||||
domainBase: this.domainBase,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.ServiceInstance = ServiceInstance;
|
||||
function ServiceListInstance(version) {
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new ServiceContextImpl(version, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/Services`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["uniqueName"] === null || params["uniqueName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['uniqueName']\" missing.");
|
||||
}
|
||||
if (params["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["UniqueName"] = params["uniqueName"];
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["includeCredentials"] !== undefined)
|
||||
data["IncludeCredentials"] = serialize.bool(params["includeCredentials"]);
|
||||
if (params["uiEditable"] !== undefined)
|
||||
data["UiEditable"] = serialize.bool(params["uiEditable"]);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["uniqueName"] === null || params["uniqueName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['uniqueName']\" missing.");
|
||||
}
|
||||
if (params["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["UniqueName"] = params["uniqueName"];
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["includeCredentials"] !== undefined)
|
||||
data["IncludeCredentials"] = serialize.bool(params["includeCredentials"]);
|
||||
if (params["uiEditable"] !== undefined)
|
||||
data["UiEditable"] = serialize.bool(params["uiEditable"]);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new ServiceInstance(operationVersion, response.body),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["pageSize"] !== undefined)
|
||||
data["PageSize"] = params["pageSize"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.page({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new ServicePage(operationVersion, payload, instance._solution));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.each = instance._version.each;
|
||||
instance.list = instance._version.list;
|
||||
instance.getPage = function getPage(targetUrl, callback) {
|
||||
const operationPromise = instance._version._domain.twilio.request({
|
||||
method: "get",
|
||||
uri: targetUrl,
|
||||
});
|
||||
let pagePromise = operationPromise.then((payload) => new ServicePage(instance._version, payload, instance._solution));
|
||||
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
||||
return pagePromise;
|
||||
};
|
||||
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["pageSize"] !== undefined)
|
||||
data["PageSize"] = params["pageSize"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
||||
// IMPORTANT: Pass full response to Page constructor, not response.body
|
||||
let operationPromise = operationVersion
|
||||
.page({ uri: instance._uri, method: "get", params: data, headers })
|
||||
.then((response) => ({
|
||||
statusCode: response.statusCode,
|
||||
headers: response.headers,
|
||||
body: new ServicePage(operationVersion, response, instance._solution),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.each = instance._version.each;
|
||||
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
||||
instance.list = instance._version.list;
|
||||
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
|
||||
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
||||
// Use request() directly as it already returns { statusCode, body, headers }
|
||||
const operationPromise = instance._version._domain.twilio.request({
|
||||
method: "get",
|
||||
uri: targetUrl,
|
||||
});
|
||||
let pagePromise = operationPromise.then((response) => ({
|
||||
statusCode: response.statusCode,
|
||||
headers: response.headers,
|
||||
body: new ServicePage(instance._version, response, instance._solution),
|
||||
}));
|
||||
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
||||
return pagePromise;
|
||||
};
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
class ServicePage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the ServicePage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version, response, solution) {
|
||||
super(version, response, solution);
|
||||
}
|
||||
/**
|
||||
* Build an instance of ServiceInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new ServiceInstance(this._version, payload);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.ServicePage = ServicePage;
|
||||
412
node_modules/twilio/lib/rest/serverless/v1/service/asset.d.ts
generated
vendored
Normal file
412
node_modules/twilio/lib/rest/serverless/v1/service/asset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
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 { AssetVersionListInstance } from "./asset/assetVersion";
|
||||
/**
|
||||
* Options to pass to update a AssetInstance
|
||||
*/
|
||||
export interface AssetContextUpdateOptions {
|
||||
/** A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. */
|
||||
friendlyName: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a AssetInstance
|
||||
*/
|
||||
export interface AssetListInstanceCreateOptions {
|
||||
/** A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. */
|
||||
friendlyName: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface AssetListInstanceEachOptions {
|
||||
/** 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: AssetInstance, 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 AssetListInstanceOptions {
|
||||
/** 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 AssetListInstancePageOptions {
|
||||
/** 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 AssetContext {
|
||||
assetVersions: AssetVersionListInstance;
|
||||
/**
|
||||
* Remove a AssetInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a AssetInstance 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 AssetInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
/**
|
||||
* Fetch a AssetInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
/**
|
||||
* Update a AssetInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance
|
||||
*/
|
||||
update(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
/**
|
||||
* Update a AssetInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface AssetContextSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class AssetContextImpl implements AssetContext {
|
||||
protected _version: V1;
|
||||
protected _solution: AssetContextSolution;
|
||||
protected _uri: string;
|
||||
protected _assetVersions?: AssetVersionListInstance;
|
||||
constructor(_version: V1, serviceSid: string, sid: string);
|
||||
get assetVersions(): AssetVersionListInstance;
|
||||
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?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
update(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
updateWithHttpInfo(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): AssetContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface AssetPayload extends TwilioResponsePayload {
|
||||
assets: AssetResource[];
|
||||
}
|
||||
interface AssetResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
friendly_name: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class AssetInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: AssetContextSolution;
|
||||
protected _context?: AssetContext;
|
||||
constructor(_version: V1, payload: AssetResource, serviceSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Asset resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Asset resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters.
|
||||
*/
|
||||
friendlyName: string;
|
||||
/**
|
||||
* The date and time in GMT when the Asset resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Asset resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Asset resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The URLs of the Asset resource\'s nested resources.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a AssetInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a AssetInstance 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 AssetInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
/**
|
||||
* Fetch a AssetInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
/**
|
||||
* Update a AssetInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance
|
||||
*/
|
||||
update(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
/**
|
||||
* Update a AssetInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
/**
|
||||
* Access the assetVersions.
|
||||
*/
|
||||
assetVersions(): AssetVersionListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
friendlyName: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface AssetSolution {
|
||||
serviceSid: string;
|
||||
}
|
||||
export interface AssetListInstance {
|
||||
_version: V1;
|
||||
_solution: AssetSolution;
|
||||
_uri: string;
|
||||
(sid: string): AssetContext;
|
||||
get(sid: string): AssetContext;
|
||||
/**
|
||||
* Create a AssetInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance
|
||||
*/
|
||||
create(params: AssetListInstanceCreateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>;
|
||||
/**
|
||||
* Create a AssetInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: AssetListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<AssetInstance>) => any): Promise<ApiResponse<AssetInstance>>;
|
||||
/**
|
||||
* Streams AssetInstance 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 { AssetListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: AssetInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: AssetListInstanceEachOptions, callback?: (item: AssetInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams AssetInstance 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 { AssetListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: AssetInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: AssetListInstanceEachOptions, callback?: (item: AssetInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of AssetInstance 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: AssetPage) => any): Promise<AssetPage>;
|
||||
/**
|
||||
* Retrieve a single target page of AssetInstance 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<AssetPage>) => any): Promise<ApiResponse<AssetPage>>;
|
||||
/**
|
||||
* Lists AssetInstance 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 { AssetListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: AssetInstance[]) => any): Promise<AssetInstance[]>;
|
||||
list(params: AssetListInstanceOptions, callback?: (error: Error | null, items: AssetInstance[]) => any): Promise<AssetInstance[]>;
|
||||
/**
|
||||
* Lists AssetInstance 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 { AssetListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssetInstance[]>) => any): Promise<ApiResponse<AssetInstance[]>>;
|
||||
listWithHttpInfo(params: AssetListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AssetInstance[]>) => any): Promise<ApiResponse<AssetInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of AssetInstance 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 { AssetListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: AssetPage) => any): Promise<AssetPage>;
|
||||
page(params: AssetListInstancePageOptions, callback?: (error: Error | null, items: AssetPage) => any): Promise<AssetPage>;
|
||||
/**
|
||||
* Retrieve a single page of AssetInstance 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 { AssetListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssetPage>) => any): Promise<ApiResponse<AssetPage>>;
|
||||
pageWithHttpInfo(params: AssetListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AssetPage>) => any): Promise<ApiResponse<AssetPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function AssetListInstance(version: V1, serviceSid: string): AssetListInstance;
|
||||
export declare class AssetPage extends Page<V1, AssetPayload, AssetResource, AssetInstance> {
|
||||
/**
|
||||
* Initialize the AssetPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: AssetSolution);
|
||||
/**
|
||||
* Build an instance of AssetInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: AssetResource): AssetInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
442
node_modules/twilio/lib/rest/serverless/v1/service/asset.js
generated
vendored
Normal file
442
node_modules/twilio/lib/rest/serverless/v1/service/asset.js
generated
vendored
Normal file
@@ -0,0 +1,442 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.AssetPage = exports.AssetInstance = exports.AssetContextImpl = void 0;
|
||||
exports.AssetListInstance = AssetListInstance;
|
||||
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 assetVersion_1 = require("./asset/assetVersion");
|
||||
class AssetContextImpl {
|
||||
constructor(_version, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Assets/${sid}`;
|
||||
}
|
||||
get assetVersions() {
|
||||
this._assetVersions =
|
||||
this._assetVersions ||
|
||||
(0, assetVersion_1.AssetVersionListInstance)(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._assetVersions;
|
||||
}
|
||||
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 AssetInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new AssetInstance(operationVersion, response.body, instance._solution.serviceSid, 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["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 AssetInstance(operationVersion, payload, instance._solution.serviceSid, 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["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 AssetInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AssetContextImpl = AssetContextImpl;
|
||||
class AssetInstance {
|
||||
constructor(_version, payload, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.friendlyName = payload.friendly_name;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { serviceSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new AssetContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a AssetInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a AssetInstance 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 AssetInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a AssetInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetInstance 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 assetVersions.
|
||||
*/
|
||||
assetVersions() {
|
||||
return this._proxy.assetVersions;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
friendlyName: this.friendlyName,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AssetInstance = AssetInstance;
|
||||
function AssetListInstance(version, serviceSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new AssetContextImpl(version, serviceSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid };
|
||||
instance._uri = `/Services/${serviceSid}/Assets`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 AssetInstance(operationVersion, payload, instance._solution.serviceSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 AssetInstance(operationVersion, response.body, instance._solution.serviceSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["pageSize"] !== undefined)
|
||||
data["PageSize"] = params["pageSize"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.page({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new AssetPage(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 AssetPage(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 AssetPage(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 AssetPage(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 AssetPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the AssetPage
|
||||
*
|
||||
* @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 AssetInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new AssetInstance(this._version, payload, this._solution.serviceSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AssetPage = AssetPage;
|
||||
303
node_modules/twilio/lib/rest/serverless/v1/service/asset/assetVersion.d.ts
generated
vendored
Normal file
303
node_modules/twilio/lib/rest/serverless/v1/service/asset/assetVersion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import Page, { TwilioResponsePayload } from "../../../../../base/Page";
|
||||
import Response from "../../../../../http/response";
|
||||
import V1 from "../../../V1";
|
||||
import { ApiResponse } from "../../../../../base/ApiResponse";
|
||||
/**
|
||||
* The access control that determines how the Asset Version resource can be accessed. Can be: `public`, `protected`, or `private`.
|
||||
*/
|
||||
export type AssetVersionVisibility = "public" | "private" | "protected";
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface AssetVersionListInstanceEachOptions {
|
||||
/** 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: AssetVersionInstance, 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 AssetVersionListInstanceOptions {
|
||||
/** 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 AssetVersionListInstancePageOptions {
|
||||
/** 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 AssetVersionContext {
|
||||
/**
|
||||
* Fetch a AssetVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetVersionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AssetVersionInstance) => any): Promise<AssetVersionInstance>;
|
||||
/**
|
||||
* Fetch a AssetVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssetVersionInstance>) => any): Promise<ApiResponse<AssetVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface AssetVersionContextSolution {
|
||||
serviceSid: string;
|
||||
assetSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class AssetVersionContextImpl implements AssetVersionContext {
|
||||
protected _version: V1;
|
||||
protected _solution: AssetVersionContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, assetSid: string, sid: string);
|
||||
fetch(callback?: (error: Error | null, item?: AssetVersionInstance) => any): Promise<AssetVersionInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssetVersionInstance>) => any): Promise<ApiResponse<AssetVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): AssetVersionContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface AssetVersionPayload extends TwilioResponsePayload {
|
||||
asset_versions: AssetVersionResource[];
|
||||
}
|
||||
interface AssetVersionResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
asset_sid: string;
|
||||
path: string;
|
||||
visibility: AssetVersionVisibility;
|
||||
date_created: Date;
|
||||
url: string;
|
||||
}
|
||||
export declare class AssetVersionInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: AssetVersionContextSolution;
|
||||
protected _context?: AssetVersionContext;
|
||||
constructor(_version: V1, payload: AssetVersionResource, serviceSid: string, assetSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Asset Version resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset Version resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Asset Version resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the Asset resource that is the parent of the Asset Version.
|
||||
*/
|
||||
assetSid: string;
|
||||
/**
|
||||
* The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (\'/\'). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.
|
||||
*/
|
||||
path: string;
|
||||
visibility: AssetVersionVisibility;
|
||||
/**
|
||||
* The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The absolute URL of the Asset Version resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a AssetVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetVersionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AssetVersionInstance) => any): Promise<AssetVersionInstance>;
|
||||
/**
|
||||
* Fetch a AssetVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssetVersionInstance>) => any): Promise<ApiResponse<AssetVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
assetSid: string;
|
||||
path: string;
|
||||
visibility: AssetVersionVisibility;
|
||||
dateCreated: Date;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface AssetVersionSolution {
|
||||
serviceSid: string;
|
||||
assetSid: string;
|
||||
}
|
||||
export interface AssetVersionListInstance {
|
||||
_version: V1;
|
||||
_solution: AssetVersionSolution;
|
||||
_uri: string;
|
||||
(sid: string): AssetVersionContext;
|
||||
get(sid: string): AssetVersionContext;
|
||||
/**
|
||||
* Streams AssetVersionInstance 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 { AssetVersionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: AssetVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: AssetVersionListInstanceEachOptions, callback?: (item: AssetVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams AssetVersionInstance 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 { AssetVersionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: AssetVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: AssetVersionListInstanceEachOptions, callback?: (item: AssetVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of AssetVersionInstance 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: AssetVersionPage) => any): Promise<AssetVersionPage>;
|
||||
/**
|
||||
* Retrieve a single target page of AssetVersionInstance 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<AssetVersionPage>) => any): Promise<ApiResponse<AssetVersionPage>>;
|
||||
/**
|
||||
* Lists AssetVersionInstance 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 { AssetVersionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: AssetVersionInstance[]) => any): Promise<AssetVersionInstance[]>;
|
||||
list(params: AssetVersionListInstanceOptions, callback?: (error: Error | null, items: AssetVersionInstance[]) => any): Promise<AssetVersionInstance[]>;
|
||||
/**
|
||||
* Lists AssetVersionInstance 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 { AssetVersionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssetVersionInstance[]>) => any): Promise<ApiResponse<AssetVersionInstance[]>>;
|
||||
listWithHttpInfo(params: AssetVersionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AssetVersionInstance[]>) => any): Promise<ApiResponse<AssetVersionInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of AssetVersionInstance 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 { AssetVersionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: AssetVersionPage) => any): Promise<AssetVersionPage>;
|
||||
page(params: AssetVersionListInstancePageOptions, callback?: (error: Error | null, items: AssetVersionPage) => any): Promise<AssetVersionPage>;
|
||||
/**
|
||||
* Retrieve a single page of AssetVersionInstance 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 { AssetVersionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssetVersionPage>) => any): Promise<ApiResponse<AssetVersionPage>>;
|
||||
pageWithHttpInfo(params: AssetVersionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AssetVersionPage>) => any): Promise<ApiResponse<AssetVersionPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function AssetVersionListInstance(version: V1, serviceSid: string, assetSid: string): AssetVersionListInstance;
|
||||
export declare class AssetVersionPage extends Page<V1, AssetVersionPayload, AssetVersionResource, AssetVersionInstance> {
|
||||
/**
|
||||
* Initialize the AssetVersionPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: AssetVersionSolution);
|
||||
/**
|
||||
* Build an instance of AssetVersionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: AssetVersionResource): AssetVersionInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
278
node_modules/twilio/lib/rest/serverless/v1/service/asset/assetVersion.js
generated
vendored
Normal file
278
node_modules/twilio/lib/rest/serverless/v1/service/asset/assetVersion.js
generated
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.AssetVersionPage = exports.AssetVersionInstance = exports.AssetVersionContextImpl = void 0;
|
||||
exports.AssetVersionListInstance = AssetVersionListInstance;
|
||||
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 AssetVersionContextImpl {
|
||||
constructor(_version, serviceSid, assetSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(assetSid)) {
|
||||
throw new Error("Parameter 'assetSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, assetSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Assets/${assetSid}/Versions/${sid}`;
|
||||
}
|
||||
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 AssetVersionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.assetSid, 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 AssetVersionInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.assetSid, 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.AssetVersionContextImpl = AssetVersionContextImpl;
|
||||
class AssetVersionInstance {
|
||||
constructor(_version, payload, serviceSid, assetSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.assetSid = payload.asset_sid;
|
||||
this.path = payload.path;
|
||||
this.visibility = payload.visibility;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.url = payload.url;
|
||||
this._solution = { serviceSid, assetSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new AssetVersionContextImpl(this._version, this._solution.serviceSid, this._solution.assetSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a AssetVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetVersionInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a AssetVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AssetVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
assetSid: this.assetSid,
|
||||
path: this.path,
|
||||
visibility: this.visibility,
|
||||
dateCreated: this.dateCreated,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AssetVersionInstance = AssetVersionInstance;
|
||||
function AssetVersionListInstance(version, serviceSid, assetSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(assetSid)) {
|
||||
throw new Error("Parameter 'assetSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new AssetVersionContextImpl(version, serviceSid, assetSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, assetSid };
|
||||
instance._uri = `/Services/${serviceSid}/Assets/${assetSid}/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 AssetVersionPage(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 AssetVersionPage(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 AssetVersionPage(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 AssetVersionPage(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 AssetVersionPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the AssetVersionPage
|
||||
*
|
||||
* @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 AssetVersionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new AssetVersionInstance(this._version, payload, this._solution.serviceSid, this._solution.assetSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AssetVersionPage = AssetVersionPage;
|
||||
412
node_modules/twilio/lib/rest/serverless/v1/service/build.d.ts
generated
vendored
Normal file
412
node_modules/twilio/lib/rest/serverless/v1/service/build.d.ts
generated
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
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 { BuildStatusListInstance } from "./build/buildStatus";
|
||||
/**
|
||||
* The Runtime version that will be used to run the Build resource when it is deployed.
|
||||
*/
|
||||
export type BuildRuntime = "node8" | "node10" | "node12" | "node14" | "node16" | "node18" | "node20" | "node22";
|
||||
/**
|
||||
* The status of the Build. Can be: `building`, `completed`, or `failed`.
|
||||
*/
|
||||
export type BuildStatus = "building" | "completed" | "failed";
|
||||
/**
|
||||
* Options to pass to create a BuildInstance
|
||||
*/
|
||||
export interface BuildListInstanceCreateOptions {
|
||||
/** The list of Asset Version resource SIDs to include in the Build. */
|
||||
assetVersions?: Array<string>;
|
||||
/** The list of the Function Version resource SIDs to include in the Build. */
|
||||
functionVersions?: Array<string>;
|
||||
/** A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. */
|
||||
dependencies?: string;
|
||||
/** The Runtime version that will be used to run the Build resource when it is deployed. */
|
||||
runtime?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface BuildListInstanceEachOptions {
|
||||
/** 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: BuildInstance, 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 BuildListInstanceOptions {
|
||||
/** 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 BuildListInstancePageOptions {
|
||||
/** 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 BuildContext {
|
||||
buildStatus: BuildStatusListInstance;
|
||||
/**
|
||||
* Remove a BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a BuildInstance 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 BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>;
|
||||
/**
|
||||
* Fetch a BuildInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildInstance>) => any): Promise<ApiResponse<BuildInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface BuildContextSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class BuildContextImpl implements BuildContext {
|
||||
protected _version: V1;
|
||||
protected _solution: BuildContextSolution;
|
||||
protected _uri: string;
|
||||
protected _buildStatus?: BuildStatusListInstance;
|
||||
constructor(_version: V1, serviceSid: string, sid: string);
|
||||
get buildStatus(): BuildStatusListInstance;
|
||||
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?: BuildInstance) => any): Promise<BuildInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildInstance>) => any): Promise<ApiResponse<BuildInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): BuildContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface BuildPayload extends TwilioResponsePayload {
|
||||
builds: BuildResource[];
|
||||
}
|
||||
interface BuildResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
status: BuildStatus;
|
||||
asset_versions: Array<any>;
|
||||
function_versions: Array<any>;
|
||||
dependencies: Array<any>;
|
||||
runtime: BuildRuntime;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class BuildInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: BuildContextSolution;
|
||||
protected _context?: BuildContext;
|
||||
constructor(_version: V1, payload: BuildResource, serviceSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Build resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Build resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
status: BuildStatus;
|
||||
/**
|
||||
* The list of Asset Version resource SIDs that are included in the Build.
|
||||
*/
|
||||
assetVersions: Array<any>;
|
||||
/**
|
||||
* The list of Function Version resource SIDs that are included in the Build.
|
||||
*/
|
||||
functionVersions: Array<any>;
|
||||
/**
|
||||
* A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency.
|
||||
*/
|
||||
dependencies: Array<any>;
|
||||
runtime: BuildRuntime;
|
||||
/**
|
||||
* The date and time in GMT when the Build resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Build resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Build resource.
|
||||
*/
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a BuildInstance 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 BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>;
|
||||
/**
|
||||
* Fetch a BuildInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildInstance>) => any): Promise<ApiResponse<BuildInstance>>;
|
||||
/**
|
||||
* Access the buildStatus.
|
||||
*/
|
||||
buildStatus(): BuildStatusListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
status: BuildStatus;
|
||||
assetVersions: any[];
|
||||
functionVersions: any[];
|
||||
dependencies: any[];
|
||||
runtime: BuildRuntime;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface BuildSolution {
|
||||
serviceSid: string;
|
||||
}
|
||||
export interface BuildListInstance {
|
||||
_version: V1;
|
||||
_solution: BuildSolution;
|
||||
_uri: string;
|
||||
(sid: string): BuildContext;
|
||||
get(sid: string): BuildContext;
|
||||
/**
|
||||
* Create a BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance
|
||||
*/
|
||||
create(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>;
|
||||
/**
|
||||
* Create a BuildInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance
|
||||
*/
|
||||
create(params: BuildListInstanceCreateOptions, callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>;
|
||||
/**
|
||||
* Create a BuildInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildInstance>) => any): Promise<ApiResponse<BuildInstance>>;
|
||||
/**
|
||||
* Create a BuildInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: BuildListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<BuildInstance>) => any): Promise<ApiResponse<BuildInstance>>;
|
||||
/**
|
||||
* Streams BuildInstance 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 { BuildListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: BuildInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: BuildListInstanceEachOptions, callback?: (item: BuildInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams BuildInstance 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 { BuildListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: BuildInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: BuildListInstanceEachOptions, callback?: (item: BuildInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of BuildInstance 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: BuildPage) => any): Promise<BuildPage>;
|
||||
/**
|
||||
* Retrieve a single target page of BuildInstance 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<BuildPage>) => any): Promise<ApiResponse<BuildPage>>;
|
||||
/**
|
||||
* Lists BuildInstance 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 { BuildListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: BuildInstance[]) => any): Promise<BuildInstance[]>;
|
||||
list(params: BuildListInstanceOptions, callback?: (error: Error | null, items: BuildInstance[]) => any): Promise<BuildInstance[]>;
|
||||
/**
|
||||
* Lists BuildInstance 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 { BuildListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BuildInstance[]>) => any): Promise<ApiResponse<BuildInstance[]>>;
|
||||
listWithHttpInfo(params: BuildListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<BuildInstance[]>) => any): Promise<ApiResponse<BuildInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of BuildInstance 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 { BuildListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: BuildPage) => any): Promise<BuildPage>;
|
||||
page(params: BuildListInstancePageOptions, callback?: (error: Error | null, items: BuildPage) => any): Promise<BuildPage>;
|
||||
/**
|
||||
* Retrieve a single page of BuildInstance 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 { BuildListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BuildPage>) => any): Promise<ApiResponse<BuildPage>>;
|
||||
pageWithHttpInfo(params: BuildListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<BuildPage>) => any): Promise<ApiResponse<BuildPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function BuildListInstance(version: V1, serviceSid: string): BuildListInstance;
|
||||
export declare class BuildPage extends Page<V1, BuildPayload, BuildResource, BuildInstance> {
|
||||
/**
|
||||
* Initialize the BuildPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: BuildSolution);
|
||||
/**
|
||||
* Build an instance of BuildInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: BuildResource): BuildInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
404
node_modules/twilio/lib/rest/serverless/v1/service/build.js
generated
vendored
Normal file
404
node_modules/twilio/lib/rest/serverless/v1/service/build.js
generated
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.BuildPage = exports.BuildInstance = exports.BuildContextImpl = void 0;
|
||||
exports.BuildListInstance = BuildListInstance;
|
||||
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 buildStatus_1 = require("./build/buildStatus");
|
||||
class BuildContextImpl {
|
||||
constructor(_version, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Builds/${sid}`;
|
||||
}
|
||||
get buildStatus() {
|
||||
this._buildStatus =
|
||||
this._buildStatus ||
|
||||
(0, buildStatus_1.BuildStatusListInstance)(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._buildStatus;
|
||||
}
|
||||
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 BuildInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new BuildInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BuildContextImpl = BuildContextImpl;
|
||||
class BuildInstance {
|
||||
constructor(_version, payload, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.status = payload.status;
|
||||
this.assetVersions = payload.asset_versions;
|
||||
this.functionVersions = payload.function_versions;
|
||||
this.dependencies = payload.dependencies;
|
||||
this.runtime = payload.runtime;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { serviceSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new BuildContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a BuildInstance 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 BuildInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a BuildInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Access the buildStatus.
|
||||
*/
|
||||
buildStatus() {
|
||||
return this._proxy.buildStatus;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
status: this.status,
|
||||
assetVersions: this.assetVersions,
|
||||
functionVersions: this.functionVersions,
|
||||
dependencies: this.dependencies,
|
||||
runtime: this.runtime,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BuildInstance = BuildInstance;
|
||||
function BuildListInstance(version, serviceSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new BuildContextImpl(version, serviceSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid };
|
||||
instance._uri = `/Services/${serviceSid}/Builds`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["assetVersions"] !== undefined)
|
||||
data["AssetVersions"] = serialize.map(params["assetVersions"], (e) => e);
|
||||
if (params["functionVersions"] !== undefined)
|
||||
data["FunctionVersions"] = serialize.map(params["functionVersions"], (e) => e);
|
||||
if (params["dependencies"] !== undefined)
|
||||
data["Dependencies"] = params["dependencies"];
|
||||
if (params["runtime"] !== undefined)
|
||||
data["Runtime"] = params["runtime"];
|
||||
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 BuildInstance(operationVersion, payload, instance._solution.serviceSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["assetVersions"] !== undefined)
|
||||
data["AssetVersions"] = serialize.map(params["assetVersions"], (e) => e);
|
||||
if (params["functionVersions"] !== undefined)
|
||||
data["FunctionVersions"] = serialize.map(params["functionVersions"], (e) => e);
|
||||
if (params["dependencies"] !== undefined)
|
||||
data["Dependencies"] = params["dependencies"];
|
||||
if (params["runtime"] !== undefined)
|
||||
data["Runtime"] = params["runtime"];
|
||||
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 BuildInstance(operationVersion, response.body, instance._solution.serviceSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["pageSize"] !== undefined)
|
||||
data["PageSize"] = params["pageSize"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.page({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new BuildPage(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 BuildPage(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 BuildPage(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 BuildPage(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 BuildPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the BuildPage
|
||||
*
|
||||
* @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 BuildInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new BuildInstance(this._version, payload, this._solution.serviceSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BuildPage = BuildPage;
|
||||
127
node_modules/twilio/lib/rest/serverless/v1/service/build/buildStatus.d.ts
generated
vendored
Normal file
127
node_modules/twilio/lib/rest/serverless/v1/service/build/buildStatus.d.ts
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../../../V1";
|
||||
import { ApiResponse } from "../../../../../base/ApiResponse";
|
||||
/**
|
||||
* The status of the Build. Can be: `building`, `completed`, or `failed`.
|
||||
*/
|
||||
export type BuildStatusStatus = "building" | "completed" | "failed";
|
||||
export interface BuildStatusContext {
|
||||
/**
|
||||
* Fetch a BuildStatusInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildStatusInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: BuildStatusInstance) => any): Promise<BuildStatusInstance>;
|
||||
/**
|
||||
* Fetch a BuildStatusInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildStatusInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildStatusInstance>) => any): Promise<ApiResponse<BuildStatusInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface BuildStatusContextSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class BuildStatusContextImpl implements BuildStatusContext {
|
||||
protected _version: V1;
|
||||
protected _solution: BuildStatusContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, sid: string);
|
||||
fetch(callback?: (error: Error | null, item?: BuildStatusInstance) => any): Promise<BuildStatusInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildStatusInstance>) => any): Promise<ApiResponse<BuildStatusInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): BuildStatusContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface BuildStatusResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
status: BuildStatusStatus;
|
||||
url: string;
|
||||
}
|
||||
export declare class BuildStatusInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: BuildStatusContextSolution;
|
||||
protected _context?: BuildStatusContext;
|
||||
constructor(_version: V1, payload: BuildStatusResource, serviceSid: string, sid: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Build resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Build resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
status: BuildStatusStatus;
|
||||
/**
|
||||
* The absolute URL of the Build Status resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a BuildStatusInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildStatusInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: BuildStatusInstance) => any): Promise<BuildStatusInstance>;
|
||||
/**
|
||||
* Fetch a BuildStatusInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildStatusInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BuildStatusInstance>) => any): Promise<ApiResponse<BuildStatusInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
status: BuildStatusStatus;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface BuildStatusSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export interface BuildStatusListInstance {
|
||||
_version: V1;
|
||||
_solution: BuildStatusSolution;
|
||||
_uri: string;
|
||||
(): BuildStatusContext;
|
||||
get(): BuildStatusContext;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function BuildStatusListInstance(version: V1, serviceSid: string, sid: string): BuildStatusListInstance;
|
||||
export {};
|
||||
155
node_modules/twilio/lib/rest/serverless/v1/service/build/buildStatus.js
generated
vendored
Normal file
155
node_modules/twilio/lib/rest/serverless/v1/service/build/buildStatus.js
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.BuildStatusInstance = exports.BuildStatusContextImpl = void 0;
|
||||
exports.BuildStatusListInstance = BuildStatusListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../../../base/deserialize");
|
||||
const serialize = require("../../../../../base/serialize");
|
||||
const utility_1 = require("../../../../../base/utility");
|
||||
class BuildStatusContextImpl {
|
||||
constructor(_version, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Builds/${sid}/Status`;
|
||||
}
|
||||
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 BuildStatusInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new BuildStatusInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BuildStatusContextImpl = BuildStatusContextImpl;
|
||||
class BuildStatusInstance {
|
||||
constructor(_version, payload, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.status = payload.status;
|
||||
this.url = payload.url;
|
||||
this._solution = { serviceSid, sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new BuildStatusContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a BuildStatusInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildStatusInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a BuildStatusInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BuildStatusInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
status: this.status,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BuildStatusInstance = BuildStatusInstance;
|
||||
function BuildStatusListInstance(version, serviceSid, sid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
const instance = (() => instance.get());
|
||||
instance.get = function get() {
|
||||
return new BuildStatusContextImpl(version, serviceSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, sid };
|
||||
instance._uri = ``;
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
403
node_modules/twilio/lib/rest/serverless/v1/service/environment.d.ts
generated
vendored
Normal file
403
node_modules/twilio/lib/rest/serverless/v1/service/environment.d.ts
generated
vendored
Normal file
@@ -0,0 +1,403 @@
|
||||
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 { DeploymentListInstance } from "./environment/deployment";
|
||||
import { LogListInstance } from "./environment/log";
|
||||
import { VariableListInstance } from "./environment/variable";
|
||||
/**
|
||||
* Options to pass to create a EnvironmentInstance
|
||||
*/
|
||||
export interface EnvironmentListInstanceCreateOptions {
|
||||
/** A user-defined string that uniquely identifies the Environment resource. It can be a maximum of 100 characters. */
|
||||
uniqueName: string;
|
||||
/** A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters. */
|
||||
domainSuffix?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface EnvironmentListInstanceEachOptions {
|
||||
/** 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: EnvironmentInstance, 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 EnvironmentListInstanceOptions {
|
||||
/** 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 EnvironmentListInstancePageOptions {
|
||||
/** 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 EnvironmentContext {
|
||||
deployments: DeploymentListInstance;
|
||||
logs: LogListInstance;
|
||||
variables: VariableListInstance;
|
||||
/**
|
||||
* Remove a EnvironmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a EnvironmentInstance 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 EnvironmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>;
|
||||
/**
|
||||
* Fetch a EnvironmentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EnvironmentInstance>) => any): Promise<ApiResponse<EnvironmentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface EnvironmentContextSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class EnvironmentContextImpl implements EnvironmentContext {
|
||||
protected _version: V1;
|
||||
protected _solution: EnvironmentContextSolution;
|
||||
protected _uri: string;
|
||||
protected _deployments?: DeploymentListInstance;
|
||||
protected _logs?: LogListInstance;
|
||||
protected _variables?: VariableListInstance;
|
||||
constructor(_version: V1, serviceSid: string, sid: string);
|
||||
get deployments(): DeploymentListInstance;
|
||||
get logs(): LogListInstance;
|
||||
get variables(): VariableListInstance;
|
||||
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?: EnvironmentInstance) => any): Promise<EnvironmentInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EnvironmentInstance>) => any): Promise<ApiResponse<EnvironmentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): EnvironmentContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface EnvironmentPayload extends TwilioResponsePayload {
|
||||
environments: EnvironmentResource[];
|
||||
}
|
||||
interface EnvironmentResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
build_sid: string;
|
||||
unique_name: string;
|
||||
domain_suffix: string;
|
||||
domain_name: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class EnvironmentInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: EnvironmentContextSolution;
|
||||
protected _context?: EnvironmentContext;
|
||||
constructor(_version: V1, payload: EnvironmentResource, serviceSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Environment resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Environment resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the build deployed in the environment.
|
||||
*/
|
||||
buildSid: string;
|
||||
/**
|
||||
* A user-defined string that uniquely identifies the Environment resource.
|
||||
*/
|
||||
uniqueName: string;
|
||||
/**
|
||||
* A URL-friendly name that represents the environment and forms part of the domain name.
|
||||
*/
|
||||
domainSuffix: string;
|
||||
/**
|
||||
* The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix.
|
||||
*/
|
||||
domainName: string;
|
||||
/**
|
||||
* The date and time in GMT when the Environment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Environment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Environment resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The URLs of the Environment resource\'s nested resources.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a EnvironmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a EnvironmentInstance 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 EnvironmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>;
|
||||
/**
|
||||
* Fetch a EnvironmentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EnvironmentInstance>) => any): Promise<ApiResponse<EnvironmentInstance>>;
|
||||
/**
|
||||
* Access the deployments.
|
||||
*/
|
||||
deployments(): DeploymentListInstance;
|
||||
/**
|
||||
* Access the logs.
|
||||
*/
|
||||
logs(): LogListInstance;
|
||||
/**
|
||||
* Access the variables.
|
||||
*/
|
||||
variables(): VariableListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
buildSid: string;
|
||||
uniqueName: string;
|
||||
domainSuffix: string;
|
||||
domainName: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface EnvironmentSolution {
|
||||
serviceSid: string;
|
||||
}
|
||||
export interface EnvironmentListInstance {
|
||||
_version: V1;
|
||||
_solution: EnvironmentSolution;
|
||||
_uri: string;
|
||||
(sid: string): EnvironmentContext;
|
||||
get(sid: string): EnvironmentContext;
|
||||
/**
|
||||
* Create a EnvironmentInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance
|
||||
*/
|
||||
create(params: EnvironmentListInstanceCreateOptions, callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>;
|
||||
/**
|
||||
* Create a EnvironmentInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: EnvironmentListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<EnvironmentInstance>) => any): Promise<ApiResponse<EnvironmentInstance>>;
|
||||
/**
|
||||
* Streams EnvironmentInstance 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 { EnvironmentListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: EnvironmentInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: EnvironmentListInstanceEachOptions, callback?: (item: EnvironmentInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams EnvironmentInstance 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 { EnvironmentListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: EnvironmentInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: EnvironmentListInstanceEachOptions, callback?: (item: EnvironmentInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of EnvironmentInstance 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: EnvironmentPage) => any): Promise<EnvironmentPage>;
|
||||
/**
|
||||
* Retrieve a single target page of EnvironmentInstance 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<EnvironmentPage>) => any): Promise<ApiResponse<EnvironmentPage>>;
|
||||
/**
|
||||
* Lists EnvironmentInstance 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 { EnvironmentListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: EnvironmentInstance[]) => any): Promise<EnvironmentInstance[]>;
|
||||
list(params: EnvironmentListInstanceOptions, callback?: (error: Error | null, items: EnvironmentInstance[]) => any): Promise<EnvironmentInstance[]>;
|
||||
/**
|
||||
* Lists EnvironmentInstance 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 { EnvironmentListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EnvironmentInstance[]>) => any): Promise<ApiResponse<EnvironmentInstance[]>>;
|
||||
listWithHttpInfo(params: EnvironmentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EnvironmentInstance[]>) => any): Promise<ApiResponse<EnvironmentInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of EnvironmentInstance 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 { EnvironmentListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: EnvironmentPage) => any): Promise<EnvironmentPage>;
|
||||
page(params: EnvironmentListInstancePageOptions, callback?: (error: Error | null, items: EnvironmentPage) => any): Promise<EnvironmentPage>;
|
||||
/**
|
||||
* Retrieve a single page of EnvironmentInstance 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 { EnvironmentListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EnvironmentPage>) => any): Promise<ApiResponse<EnvironmentPage>>;
|
||||
pageWithHttpInfo(params: EnvironmentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EnvironmentPage>) => any): Promise<ApiResponse<EnvironmentPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function EnvironmentListInstance(version: V1, serviceSid: string): EnvironmentListInstance;
|
||||
export declare class EnvironmentPage extends Page<V1, EnvironmentPayload, EnvironmentResource, EnvironmentInstance> {
|
||||
/**
|
||||
* Initialize the EnvironmentPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: EnvironmentSolution);
|
||||
/**
|
||||
* Build an instance of EnvironmentInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: EnvironmentResource): EnvironmentInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
416
node_modules/twilio/lib/rest/serverless/v1/service/environment.js
generated
vendored
Normal file
416
node_modules/twilio/lib/rest/serverless/v1/service/environment.js
generated
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.EnvironmentPage = exports.EnvironmentInstance = exports.EnvironmentContextImpl = void 0;
|
||||
exports.EnvironmentListInstance = EnvironmentListInstance;
|
||||
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 deployment_1 = require("./environment/deployment");
|
||||
const log_1 = require("./environment/log");
|
||||
const variable_1 = require("./environment/variable");
|
||||
class EnvironmentContextImpl {
|
||||
constructor(_version, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Environments/${sid}`;
|
||||
}
|
||||
get deployments() {
|
||||
this._deployments =
|
||||
this._deployments ||
|
||||
(0, deployment_1.DeploymentListInstance)(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._deployments;
|
||||
}
|
||||
get logs() {
|
||||
this._logs =
|
||||
this._logs ||
|
||||
(0, log_1.LogListInstance)(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._logs;
|
||||
}
|
||||
get variables() {
|
||||
this._variables =
|
||||
this._variables ||
|
||||
(0, variable_1.VariableListInstance)(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._variables;
|
||||
}
|
||||
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 EnvironmentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new EnvironmentInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.EnvironmentContextImpl = EnvironmentContextImpl;
|
||||
class EnvironmentInstance {
|
||||
constructor(_version, payload, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.buildSid = payload.build_sid;
|
||||
this.uniqueName = payload.unique_name;
|
||||
this.domainSuffix = payload.domain_suffix;
|
||||
this.domainName = payload.domain_name;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { serviceSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new EnvironmentContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a EnvironmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a EnvironmentInstance 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 EnvironmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a EnvironmentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed EnvironmentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Access the deployments.
|
||||
*/
|
||||
deployments() {
|
||||
return this._proxy.deployments;
|
||||
}
|
||||
/**
|
||||
* Access the logs.
|
||||
*/
|
||||
logs() {
|
||||
return this._proxy.logs;
|
||||
}
|
||||
/**
|
||||
* Access the variables.
|
||||
*/
|
||||
variables() {
|
||||
return this._proxy.variables;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
buildSid: this.buildSid,
|
||||
uniqueName: this.uniqueName,
|
||||
domainSuffix: this.domainSuffix,
|
||||
domainName: this.domainName,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.EnvironmentInstance = EnvironmentInstance;
|
||||
function EnvironmentListInstance(version, serviceSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new EnvironmentContextImpl(version, serviceSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid };
|
||||
instance._uri = `/Services/${serviceSid}/Environments`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["uniqueName"] === null || params["uniqueName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['uniqueName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["UniqueName"] = params["uniqueName"];
|
||||
if (params["domainSuffix"] !== undefined)
|
||||
data["DomainSuffix"] = params["domainSuffix"];
|
||||
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 EnvironmentInstance(operationVersion, payload, instance._solution.serviceSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["uniqueName"] === null || params["uniqueName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['uniqueName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["UniqueName"] = params["uniqueName"];
|
||||
if (params["domainSuffix"] !== undefined)
|
||||
data["DomainSuffix"] = params["domainSuffix"];
|
||||
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 EnvironmentInstance(operationVersion, response.body, instance._solution.serviceSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["pageSize"] !== undefined)
|
||||
data["PageSize"] = params["pageSize"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.page({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new EnvironmentPage(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 EnvironmentPage(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 EnvironmentPage(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 EnvironmentPage(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 EnvironmentPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the EnvironmentPage
|
||||
*
|
||||
* @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 EnvironmentInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new EnvironmentInstance(this._version, payload, this._solution.serviceSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.EnvironmentPage = EnvironmentPage;
|
||||
345
node_modules/twilio/lib/rest/serverless/v1/service/environment/deployment.d.ts
generated
vendored
Normal file
345
node_modules/twilio/lib/rest/serverless/v1/service/environment/deployment.d.ts
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import Page, { TwilioResponsePayload } from "../../../../../base/Page";
|
||||
import Response from "../../../../../http/response";
|
||||
import V1 from "../../../V1";
|
||||
import { ApiResponse } from "../../../../../base/ApiResponse";
|
||||
/**
|
||||
* Options to pass to create a DeploymentInstance
|
||||
*/
|
||||
export interface DeploymentListInstanceCreateOptions {
|
||||
/** The SID of the Build for the Deployment. */
|
||||
buildSid?: string;
|
||||
/** Whether the Deployment is a plugin. */
|
||||
isPlugin?: boolean;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface DeploymentListInstanceEachOptions {
|
||||
/** 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: DeploymentInstance, 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 DeploymentListInstanceOptions {
|
||||
/** 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 DeploymentListInstancePageOptions {
|
||||
/** 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 DeploymentContext {
|
||||
/**
|
||||
* Fetch a DeploymentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>;
|
||||
/**
|
||||
* Fetch a DeploymentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DeploymentInstance>) => any): Promise<ApiResponse<DeploymentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface DeploymentContextSolution {
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class DeploymentContextImpl implements DeploymentContext {
|
||||
protected _version: V1;
|
||||
protected _solution: DeploymentContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, environmentSid: string, sid: string);
|
||||
fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DeploymentInstance>) => any): Promise<ApiResponse<DeploymentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): DeploymentContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface DeploymentPayload extends TwilioResponsePayload {
|
||||
deployments: DeploymentResource[];
|
||||
}
|
||||
interface DeploymentResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
environment_sid: string;
|
||||
build_sid: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
}
|
||||
export declare class DeploymentInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: DeploymentContextSolution;
|
||||
protected _context?: DeploymentContext;
|
||||
constructor(_version: V1, payload: DeploymentResource, serviceSid: string, environmentSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Deployment resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Deployment resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the Environment for the Deployment.
|
||||
*/
|
||||
environmentSid: string;
|
||||
/**
|
||||
* The SID of the Build for the deployment.
|
||||
*/
|
||||
buildSid: string;
|
||||
/**
|
||||
* The date and time in GMT when the Deployment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Deployment resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a DeploymentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>;
|
||||
/**
|
||||
* Fetch a DeploymentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DeploymentInstance>) => any): Promise<ApiResponse<DeploymentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
buildSid: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface DeploymentSolution {
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
}
|
||||
export interface DeploymentListInstance {
|
||||
_version: V1;
|
||||
_solution: DeploymentSolution;
|
||||
_uri: string;
|
||||
(sid: string): DeploymentContext;
|
||||
get(sid: string): DeploymentContext;
|
||||
/**
|
||||
* Create a DeploymentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance
|
||||
*/
|
||||
create(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>;
|
||||
/**
|
||||
* Create a DeploymentInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance
|
||||
*/
|
||||
create(params: DeploymentListInstanceCreateOptions, callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>;
|
||||
/**
|
||||
* Create a DeploymentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<DeploymentInstance>) => any): Promise<ApiResponse<DeploymentInstance>>;
|
||||
/**
|
||||
* Create a DeploymentInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: DeploymentListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<DeploymentInstance>) => any): Promise<ApiResponse<DeploymentInstance>>;
|
||||
/**
|
||||
* Streams DeploymentInstance 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 { DeploymentListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: DeploymentListInstanceEachOptions, callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams DeploymentInstance 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 { DeploymentListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: DeploymentListInstanceEachOptions, callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of DeploymentInstance 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: DeploymentPage) => any): Promise<DeploymentPage>;
|
||||
/**
|
||||
* Retrieve a single target page of DeploymentInstance 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<DeploymentPage>) => any): Promise<ApiResponse<DeploymentPage>>;
|
||||
/**
|
||||
* Lists DeploymentInstance 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 { DeploymentListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: DeploymentInstance[]) => any): Promise<DeploymentInstance[]>;
|
||||
list(params: DeploymentListInstanceOptions, callback?: (error: Error | null, items: DeploymentInstance[]) => any): Promise<DeploymentInstance[]>;
|
||||
/**
|
||||
* Lists DeploymentInstance 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 { DeploymentListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DeploymentInstance[]>) => any): Promise<ApiResponse<DeploymentInstance[]>>;
|
||||
listWithHttpInfo(params: DeploymentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<DeploymentInstance[]>) => any): Promise<ApiResponse<DeploymentInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of DeploymentInstance 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 { DeploymentListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: DeploymentPage) => any): Promise<DeploymentPage>;
|
||||
page(params: DeploymentListInstancePageOptions, callback?: (error: Error | null, items: DeploymentPage) => any): Promise<DeploymentPage>;
|
||||
/**
|
||||
* Retrieve a single page of DeploymentInstance 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 { DeploymentListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DeploymentPage>) => any): Promise<ApiResponse<DeploymentPage>>;
|
||||
pageWithHttpInfo(params: DeploymentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<DeploymentPage>) => any): Promise<ApiResponse<DeploymentPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function DeploymentListInstance(version: V1, serviceSid: string, environmentSid: string): DeploymentListInstance;
|
||||
export declare class DeploymentPage extends Page<V1, DeploymentPayload, DeploymentResource, DeploymentInstance> {
|
||||
/**
|
||||
* Initialize the DeploymentPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: DeploymentSolution);
|
||||
/**
|
||||
* Build an instance of DeploymentInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: DeploymentResource): DeploymentInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
336
node_modules/twilio/lib/rest/serverless/v1/service/environment/deployment.js
generated
vendored
Normal file
336
node_modules/twilio/lib/rest/serverless/v1/service/environment/deployment.js
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.DeploymentPage = exports.DeploymentInstance = exports.DeploymentContextImpl = void 0;
|
||||
exports.DeploymentListInstance = DeploymentListInstance;
|
||||
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 DeploymentContextImpl {
|
||||
constructor(_version, serviceSid, environmentSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(environmentSid)) {
|
||||
throw new Error("Parameter 'environmentSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, environmentSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Deployments/${sid}`;
|
||||
}
|
||||
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 DeploymentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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 DeploymentInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.environmentSid, 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.DeploymentContextImpl = DeploymentContextImpl;
|
||||
class DeploymentInstance {
|
||||
constructor(_version, payload, serviceSid, environmentSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.environmentSid = payload.environment_sid;
|
||||
this.buildSid = payload.build_sid;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this._solution = { serviceSid, environmentSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new DeploymentContextImpl(this._version, this._solution.serviceSid, this._solution.environmentSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a DeploymentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a DeploymentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed DeploymentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
environmentSid: this.environmentSid,
|
||||
buildSid: this.buildSid,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.DeploymentInstance = DeploymentInstance;
|
||||
function DeploymentListInstance(version, serviceSid, environmentSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(environmentSid)) {
|
||||
throw new Error("Parameter 'environmentSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new DeploymentContextImpl(version, serviceSid, environmentSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, environmentSid };
|
||||
instance._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Deployments`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["buildSid"] !== undefined)
|
||||
data["BuildSid"] = params["buildSid"];
|
||||
if (params["isPlugin"] !== undefined)
|
||||
data["IsPlugin"] = serialize.bool(params["isPlugin"]);
|
||||
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 DeploymentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["buildSid"] !== undefined)
|
||||
data["BuildSid"] = params["buildSid"];
|
||||
if (params["isPlugin"] !== undefined)
|
||||
data["IsPlugin"] = serialize.bool(params["isPlugin"]);
|
||||
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 DeploymentInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.environmentSid),
|
||||
}));
|
||||
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 DeploymentPage(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 DeploymentPage(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 DeploymentPage(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 DeploymentPage(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 DeploymentPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the DeploymentPage
|
||||
*
|
||||
* @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 DeploymentInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new DeploymentInstance(this._version, payload, this._solution.serviceSid, this._solution.environmentSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.DeploymentPage = DeploymentPage;
|
||||
344
node_modules/twilio/lib/rest/serverless/v1/service/environment/log.d.ts
generated
vendored
Normal file
344
node_modules/twilio/lib/rest/serverless/v1/service/environment/log.d.ts
generated
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
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 LogListInstanceEachOptions {
|
||||
/** The SID of the function whose invocation produced the Log resources to read. */
|
||||
functionSid?: string;
|
||||
/** The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. */
|
||||
startDate?: Date;
|
||||
/** The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. */
|
||||
endDate?: Date;
|
||||
/** 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: LogInstance, 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 LogListInstanceOptions {
|
||||
/** The SID of the function whose invocation produced the Log resources to read. */
|
||||
functionSid?: string;
|
||||
/** The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. */
|
||||
startDate?: Date;
|
||||
/** The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. */
|
||||
endDate?: Date;
|
||||
/** 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 LogListInstancePageOptions {
|
||||
/** The SID of the function whose invocation produced the Log resources to read. */
|
||||
functionSid?: string;
|
||||
/** The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. */
|
||||
startDate?: Date;
|
||||
/** The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. */
|
||||
endDate?: Date;
|
||||
/** 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 LogContext {
|
||||
/**
|
||||
* Fetch a LogInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed LogInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: LogInstance) => any): Promise<LogInstance>;
|
||||
/**
|
||||
* Fetch a LogInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed LogInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LogInstance>) => any): Promise<ApiResponse<LogInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface LogContextSolution {
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class LogContextImpl implements LogContext {
|
||||
protected _version: V1;
|
||||
protected _solution: LogContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, environmentSid: string, sid: string);
|
||||
fetch(callback?: (error: Error | null, item?: LogInstance) => any): Promise<LogInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LogInstance>) => any): Promise<ApiResponse<LogInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): LogContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface LogPayload extends TwilioResponsePayload {
|
||||
logs: LogResource[];
|
||||
}
|
||||
interface LogResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
environment_sid: string;
|
||||
build_sid: string;
|
||||
deployment_sid: string;
|
||||
function_sid: string;
|
||||
request_sid: string;
|
||||
level: string;
|
||||
message: string;
|
||||
date_created: Date;
|
||||
url: string;
|
||||
}
|
||||
export declare class LogInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: LogContextSolution;
|
||||
protected _context?: LogContext;
|
||||
constructor(_version: V1, payload: LogResource, serviceSid: string, environmentSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Log resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Log resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the environment in which the log occurred.
|
||||
*/
|
||||
environmentSid: string;
|
||||
/**
|
||||
* The SID of the build that corresponds to the log.
|
||||
*/
|
||||
buildSid: string;
|
||||
/**
|
||||
* The SID of the deployment that corresponds to the log.
|
||||
*/
|
||||
deploymentSid: string;
|
||||
/**
|
||||
* The SID of the function whose invocation produced the log.
|
||||
*/
|
||||
functionSid: string;
|
||||
/**
|
||||
* The SID of the request associated with the log.
|
||||
*/
|
||||
requestSid: string;
|
||||
/**
|
||||
* The log level.
|
||||
*/
|
||||
level: string;
|
||||
/**
|
||||
* The log message.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The absolute URL of the Log resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a LogInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed LogInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: LogInstance) => any): Promise<LogInstance>;
|
||||
/**
|
||||
* Fetch a LogInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed LogInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LogInstance>) => any): Promise<ApiResponse<LogInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
buildSid: string;
|
||||
deploymentSid: string;
|
||||
functionSid: string;
|
||||
requestSid: string;
|
||||
level: string;
|
||||
message: string;
|
||||
dateCreated: Date;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface LogSolution {
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
}
|
||||
export interface LogListInstance {
|
||||
_version: V1;
|
||||
_solution: LogSolution;
|
||||
_uri: string;
|
||||
(sid: string): LogContext;
|
||||
get(sid: string): LogContext;
|
||||
/**
|
||||
* Streams LogInstance 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 { LogListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: LogInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: LogListInstanceEachOptions, callback?: (item: LogInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams LogInstance 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 { LogListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: LogInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: LogListInstanceEachOptions, callback?: (item: LogInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of LogInstance 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: LogPage) => any): Promise<LogPage>;
|
||||
/**
|
||||
* Retrieve a single target page of LogInstance 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<LogPage>) => any): Promise<ApiResponse<LogPage>>;
|
||||
/**
|
||||
* Lists LogInstance 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 { LogListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: LogInstance[]) => any): Promise<LogInstance[]>;
|
||||
list(params: LogListInstanceOptions, callback?: (error: Error | null, items: LogInstance[]) => any): Promise<LogInstance[]>;
|
||||
/**
|
||||
* Lists LogInstance 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 { LogListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<LogInstance[]>) => any): Promise<ApiResponse<LogInstance[]>>;
|
||||
listWithHttpInfo(params: LogListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<LogInstance[]>) => any): Promise<ApiResponse<LogInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of LogInstance 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 { LogListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: LogPage) => any): Promise<LogPage>;
|
||||
page(params: LogListInstancePageOptions, callback?: (error: Error | null, items: LogPage) => any): Promise<LogPage>;
|
||||
/**
|
||||
* Retrieve a single page of LogInstance 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 { LogListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<LogPage>) => any): Promise<ApiResponse<LogPage>>;
|
||||
pageWithHttpInfo(params: LogListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<LogPage>) => any): Promise<ApiResponse<LogPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function LogListInstance(version: V1, serviceSid: string, environmentSid: string): LogListInstance;
|
||||
export declare class LogPage extends Page<V1, LogPayload, LogResource, LogInstance> {
|
||||
/**
|
||||
* Initialize the LogPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: LogSolution);
|
||||
/**
|
||||
* Build an instance of LogInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: LogResource): LogInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
298
node_modules/twilio/lib/rest/serverless/v1/service/environment/log.js
generated
vendored
Normal file
298
node_modules/twilio/lib/rest/serverless/v1/service/environment/log.js
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.LogPage = exports.LogInstance = exports.LogContextImpl = void 0;
|
||||
exports.LogListInstance = LogListInstance;
|
||||
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 LogContextImpl {
|
||||
constructor(_version, serviceSid, environmentSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(environmentSid)) {
|
||||
throw new Error("Parameter 'environmentSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, environmentSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Logs/${sid}`;
|
||||
}
|
||||
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 LogInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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 LogInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.environmentSid, 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.LogContextImpl = LogContextImpl;
|
||||
class LogInstance {
|
||||
constructor(_version, payload, serviceSid, environmentSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.environmentSid = payload.environment_sid;
|
||||
this.buildSid = payload.build_sid;
|
||||
this.deploymentSid = payload.deployment_sid;
|
||||
this.functionSid = payload.function_sid;
|
||||
this.requestSid = payload.request_sid;
|
||||
this.level = payload.level;
|
||||
this.message = payload.message;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.url = payload.url;
|
||||
this._solution = { serviceSid, environmentSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new LogContextImpl(this._version, this._solution.serviceSid, this._solution.environmentSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a LogInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed LogInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a LogInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed LogInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
environmentSid: this.environmentSid,
|
||||
buildSid: this.buildSid,
|
||||
deploymentSid: this.deploymentSid,
|
||||
functionSid: this.functionSid,
|
||||
requestSid: this.requestSid,
|
||||
level: this.level,
|
||||
message: this.message,
|
||||
dateCreated: this.dateCreated,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.LogInstance = LogInstance;
|
||||
function LogListInstance(version, serviceSid, environmentSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(environmentSid)) {
|
||||
throw new Error("Parameter 'environmentSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new LogContextImpl(version, serviceSid, environmentSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, environmentSid };
|
||||
instance._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Logs`;
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["functionSid"] !== undefined)
|
||||
data["FunctionSid"] = params["functionSid"];
|
||||
if (params["startDate"] !== undefined)
|
||||
data["StartDate"] = serialize.iso8601DateTime(params["startDate"]);
|
||||
if (params["endDate"] !== undefined)
|
||||
data["EndDate"] = serialize.iso8601DateTime(params["endDate"]);
|
||||
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 LogPage(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 LogPage(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["functionSid"] !== undefined)
|
||||
data["FunctionSid"] = params["functionSid"];
|
||||
if (params["startDate"] !== undefined)
|
||||
data["StartDate"] = serialize.iso8601DateTime(params["startDate"]);
|
||||
if (params["endDate"] !== undefined)
|
||||
data["EndDate"] = serialize.iso8601DateTime(params["endDate"]);
|
||||
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 LogPage(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 LogPage(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 LogPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the LogPage
|
||||
*
|
||||
* @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 LogInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new LogInstance(this._version, payload, this._solution.serviceSid, this._solution.environmentSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.LogPage = LogPage;
|
||||
448
node_modules/twilio/lib/rest/serverless/v1/service/environment/variable.d.ts
generated
vendored
Normal file
448
node_modules/twilio/lib/rest/serverless/v1/service/environment/variable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
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 VariableInstance
|
||||
*/
|
||||
export interface VariableContextUpdateOptions {
|
||||
/** A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. */
|
||||
key?: string;
|
||||
/** A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. */
|
||||
value?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a VariableInstance
|
||||
*/
|
||||
export interface VariableListInstanceCreateOptions {
|
||||
/** A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. */
|
||||
key: string;
|
||||
/** A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. */
|
||||
value: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface VariableListInstanceEachOptions {
|
||||
/** 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: VariableInstance, 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 VariableListInstanceOptions {
|
||||
/** 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 VariableListInstancePageOptions {
|
||||
/** 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 VariableContext {
|
||||
/**
|
||||
* Remove a VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a VariableInstance 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 VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Fetch a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Update a VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Update a VariableInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
update(params: VariableContextUpdateOptions, callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Update a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Update a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: VariableContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface VariableContextSolution {
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class VariableContextImpl implements VariableContext {
|
||||
protected _version: V1;
|
||||
protected _solution: VariableContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, environmentSid: string, sid: string);
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
update(params?: VariableContextUpdateOptions | ((error: Error | null, item?: VariableInstance) => any), callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
updateWithHttpInfo(params?: VariableContextUpdateOptions | ((error: Error | null, item?: ApiResponse<VariableInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): VariableContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface VariablePayload extends TwilioResponsePayload {
|
||||
variables: VariableResource[];
|
||||
}
|
||||
interface VariableResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
environment_sid: string;
|
||||
key: string;
|
||||
value: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
}
|
||||
export declare class VariableInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: VariableContextSolution;
|
||||
protected _context?: VariableContext;
|
||||
constructor(_version: V1, payload: VariableResource, serviceSid: string, environmentSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Variable resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Variable resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the Environment in which the Variable exists.
|
||||
*/
|
||||
environmentSid: string;
|
||||
/**
|
||||
* A string by which the Variable resource can be referenced.
|
||||
*/
|
||||
key: string;
|
||||
/**
|
||||
* A string that contains the actual value of the Variable.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* The date and time in GMT when the Variable resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Variable resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a VariableInstance 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 VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Fetch a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Update a VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Update a VariableInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
update(params: VariableContextUpdateOptions, callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Update a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Update a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: VariableContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
key: string;
|
||||
value: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface VariableSolution {
|
||||
serviceSid: string;
|
||||
environmentSid: string;
|
||||
}
|
||||
export interface VariableListInstance {
|
||||
_version: V1;
|
||||
_solution: VariableSolution;
|
||||
_uri: string;
|
||||
(sid: string): VariableContext;
|
||||
get(sid: string): VariableContext;
|
||||
/**
|
||||
* Create a VariableInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
create(params: VariableListInstanceCreateOptions, callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>;
|
||||
/**
|
||||
* Create a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: VariableListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<VariableInstance>) => any): Promise<ApiResponse<VariableInstance>>;
|
||||
/**
|
||||
* Streams VariableInstance 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 { VariableListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: VariableInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: VariableListInstanceEachOptions, callback?: (item: VariableInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams VariableInstance 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 { VariableListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: VariableInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: VariableListInstanceEachOptions, callback?: (item: VariableInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of VariableInstance 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: VariablePage) => any): Promise<VariablePage>;
|
||||
/**
|
||||
* Retrieve a single target page of VariableInstance 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<VariablePage>) => any): Promise<ApiResponse<VariablePage>>;
|
||||
/**
|
||||
* Lists VariableInstance 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 { VariableListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: VariableInstance[]) => any): Promise<VariableInstance[]>;
|
||||
list(params: VariableListInstanceOptions, callback?: (error: Error | null, items: VariableInstance[]) => any): Promise<VariableInstance[]>;
|
||||
/**
|
||||
* Lists VariableInstance 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 { VariableListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<VariableInstance[]>) => any): Promise<ApiResponse<VariableInstance[]>>;
|
||||
listWithHttpInfo(params: VariableListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<VariableInstance[]>) => any): Promise<ApiResponse<VariableInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of VariableInstance 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 { VariableListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: VariablePage) => any): Promise<VariablePage>;
|
||||
page(params: VariableListInstancePageOptions, callback?: (error: Error | null, items: VariablePage) => any): Promise<VariablePage>;
|
||||
/**
|
||||
* Retrieve a single page of VariableInstance 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 { VariableListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<VariablePage>) => any): Promise<ApiResponse<VariablePage>>;
|
||||
pageWithHttpInfo(params: VariableListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<VariablePage>) => any): Promise<ApiResponse<VariablePage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function VariableListInstance(version: V1, serviceSid: string, environmentSid: string): VariableListInstance;
|
||||
export declare class VariablePage extends Page<V1, VariablePayload, VariableResource, VariableInstance> {
|
||||
/**
|
||||
* Initialize the VariablePage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: VariableSolution);
|
||||
/**
|
||||
* Build an instance of VariableInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: VariableResource): VariableInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
449
node_modules/twilio/lib/rest/serverless/v1/service/environment/variable.js
generated
vendored
Normal file
449
node_modules/twilio/lib/rest/serverless/v1/service/environment/variable.js
generated
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.VariablePage = exports.VariableInstance = exports.VariableContextImpl = void 0;
|
||||
exports.VariableListInstance = VariableListInstance;
|
||||
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 VariableContextImpl {
|
||||
constructor(_version, serviceSid, environmentSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(environmentSid)) {
|
||||
throw new Error("Parameter 'environmentSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, environmentSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Variables/${sid}`;
|
||||
}
|
||||
remove(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
||||
uri: instance._uri,
|
||||
method: "delete",
|
||||
headers,
|
||||
});
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
removeWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// DELETE operation - returns boolean based on status code
|
||||
let operationPromise = operationVersion
|
||||
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: response.statusCode === 204,
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetch(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new VariableInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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 VariableInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.environmentSid, 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["key"] !== undefined)
|
||||
data["Key"] = params["key"];
|
||||
if (params["value"] !== undefined)
|
||||
data["Value"] = params["value"];
|
||||
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 VariableInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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["key"] !== undefined)
|
||||
data["Key"] = params["key"];
|
||||
if (params["value"] !== undefined)
|
||||
data["Value"] = params["value"];
|
||||
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 VariableInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.environmentSid, 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.VariableContextImpl = VariableContextImpl;
|
||||
class VariableInstance {
|
||||
constructor(_version, payload, serviceSid, environmentSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.environmentSid = payload.environment_sid;
|
||||
this.key = payload.key;
|
||||
this.value = payload.value;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this._solution = { serviceSid, environmentSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new VariableContextImpl(this._version, this._solution.serviceSid, this._solution.environmentSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a VariableInstance 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 VariableInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a VariableInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed VariableInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
update(params, callback) {
|
||||
return this._proxy.update(params, callback);
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
return this._proxy.updateWithHttpInfo(params, callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
environmentSid: this.environmentSid,
|
||||
key: this.key,
|
||||
value: this.value,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.VariableInstance = VariableInstance;
|
||||
function VariableListInstance(version, serviceSid, environmentSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(environmentSid)) {
|
||||
throw new Error("Parameter 'environmentSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new VariableContextImpl(version, serviceSid, environmentSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, environmentSid };
|
||||
instance._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Variables`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["key"] === null || params["key"] === undefined) {
|
||||
throw new Error("Required parameter \"params['key']\" missing.");
|
||||
}
|
||||
if (params["value"] === null || params["value"] === undefined) {
|
||||
throw new Error("Required parameter \"params['value']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Key"] = params["key"];
|
||||
data["Value"] = params["value"];
|
||||
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 VariableInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid));
|
||||
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["key"] === null || params["key"] === undefined) {
|
||||
throw new Error("Required parameter \"params['key']\" missing.");
|
||||
}
|
||||
if (params["value"] === null || params["value"] === undefined) {
|
||||
throw new Error("Required parameter \"params['value']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Key"] = params["key"];
|
||||
data["Value"] = params["value"];
|
||||
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 VariableInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.environmentSid),
|
||||
}));
|
||||
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 VariablePage(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 VariablePage(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 VariablePage(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 VariablePage(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 VariablePage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the VariablePage
|
||||
*
|
||||
* @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 VariableInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new VariableInstance(this._version, payload, this._solution.serviceSid, this._solution.environmentSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.VariablePage = VariablePage;
|
||||
412
node_modules/twilio/lib/rest/serverless/v1/service/function.d.ts
generated
vendored
Normal file
412
node_modules/twilio/lib/rest/serverless/v1/service/function.d.ts
generated
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
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 { FunctionVersionListInstance } from "./function/functionVersion";
|
||||
/**
|
||||
* Options to pass to update a FunctionInstance
|
||||
*/
|
||||
export interface FunctionContextUpdateOptions {
|
||||
/** A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. */
|
||||
friendlyName: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a FunctionInstance
|
||||
*/
|
||||
export interface FunctionListInstanceCreateOptions {
|
||||
/** A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. */
|
||||
friendlyName: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface FunctionListInstanceEachOptions {
|
||||
/** 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: FunctionInstance, 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 FunctionListInstanceOptions {
|
||||
/** 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 FunctionListInstancePageOptions {
|
||||
/** 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 FunctionContext {
|
||||
functionVersions: FunctionVersionListInstance;
|
||||
/**
|
||||
* Remove a FunctionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a FunctionInstance 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 FunctionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
/**
|
||||
* Fetch a FunctionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
/**
|
||||
* Update a FunctionInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance
|
||||
*/
|
||||
update(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
/**
|
||||
* Update a FunctionInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface FunctionContextSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class FunctionContextImpl implements FunctionContext {
|
||||
protected _version: V1;
|
||||
protected _solution: FunctionContextSolution;
|
||||
protected _uri: string;
|
||||
protected _functionVersions?: FunctionVersionListInstance;
|
||||
constructor(_version: V1, serviceSid: string, sid: string);
|
||||
get functionVersions(): FunctionVersionListInstance;
|
||||
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?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
update(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
updateWithHttpInfo(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): FunctionContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface FunctionPayload extends TwilioResponsePayload {
|
||||
functions: FunctionResource[];
|
||||
}
|
||||
interface FunctionResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
friendly_name: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class FunctionInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: FunctionContextSolution;
|
||||
protected _context?: FunctionContext;
|
||||
constructor(_version: V1, payload: FunctionResource, serviceSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Function resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Function resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The string that you assigned to describe the Function resource. It can be a maximum of 255 characters.
|
||||
*/
|
||||
friendlyName: string;
|
||||
/**
|
||||
* The date and time in GMT when the Function resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the Function resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Function resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The URLs of nested resources of the Function resource.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a FunctionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a FunctionInstance 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 FunctionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
/**
|
||||
* Fetch a FunctionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
/**
|
||||
* Update a FunctionInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance
|
||||
*/
|
||||
update(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
/**
|
||||
* Update a FunctionInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
/**
|
||||
* Access the functionVersions.
|
||||
*/
|
||||
functionVersions(): FunctionVersionListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
friendlyName: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface FunctionSolution {
|
||||
serviceSid: string;
|
||||
}
|
||||
export interface FunctionListInstance {
|
||||
_version: V1;
|
||||
_solution: FunctionSolution;
|
||||
_uri: string;
|
||||
(sid: string): FunctionContext;
|
||||
get(sid: string): FunctionContext;
|
||||
/**
|
||||
* Create a FunctionInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance
|
||||
*/
|
||||
create(params: FunctionListInstanceCreateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>;
|
||||
/**
|
||||
* Create a FunctionInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: FunctionListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<FunctionInstance>) => any): Promise<ApiResponse<FunctionInstance>>;
|
||||
/**
|
||||
* Streams FunctionInstance 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 { FunctionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: FunctionInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: FunctionListInstanceEachOptions, callback?: (item: FunctionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams FunctionInstance 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 { FunctionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: FunctionInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: FunctionListInstanceEachOptions, callback?: (item: FunctionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of FunctionInstance 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: FunctionPage) => any): Promise<FunctionPage>;
|
||||
/**
|
||||
* Retrieve a single target page of FunctionInstance 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<FunctionPage>) => any): Promise<ApiResponse<FunctionPage>>;
|
||||
/**
|
||||
* Lists FunctionInstance 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 { FunctionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: FunctionInstance[]) => any): Promise<FunctionInstance[]>;
|
||||
list(params: FunctionListInstanceOptions, callback?: (error: Error | null, items: FunctionInstance[]) => any): Promise<FunctionInstance[]>;
|
||||
/**
|
||||
* Lists FunctionInstance 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 { FunctionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FunctionInstance[]>) => any): Promise<ApiResponse<FunctionInstance[]>>;
|
||||
listWithHttpInfo(params: FunctionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FunctionInstance[]>) => any): Promise<ApiResponse<FunctionInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of FunctionInstance 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 { FunctionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: FunctionPage) => any): Promise<FunctionPage>;
|
||||
page(params: FunctionListInstancePageOptions, callback?: (error: Error | null, items: FunctionPage) => any): Promise<FunctionPage>;
|
||||
/**
|
||||
* Retrieve a single page of FunctionInstance 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 { FunctionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FunctionPage>) => any): Promise<ApiResponse<FunctionPage>>;
|
||||
pageWithHttpInfo(params: FunctionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FunctionPage>) => any): Promise<ApiResponse<FunctionPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function FunctionListInstance(version: V1, serviceSid: string): FunctionListInstance;
|
||||
export declare class FunctionPage extends Page<V1, FunctionPayload, FunctionResource, FunctionInstance> {
|
||||
/**
|
||||
* Initialize the FunctionPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: FunctionSolution);
|
||||
/**
|
||||
* Build an instance of FunctionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: FunctionResource): FunctionInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
442
node_modules/twilio/lib/rest/serverless/v1/service/function.js
generated
vendored
Normal file
442
node_modules/twilio/lib/rest/serverless/v1/service/function.js
generated
vendored
Normal file
@@ -0,0 +1,442 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.FunctionPage = exports.FunctionInstance = exports.FunctionContextImpl = void 0;
|
||||
exports.FunctionListInstance = FunctionListInstance;
|
||||
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 functionVersion_1 = require("./function/functionVersion");
|
||||
class FunctionContextImpl {
|
||||
constructor(_version, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Functions/${sid}`;
|
||||
}
|
||||
get functionVersions() {
|
||||
this._functionVersions =
|
||||
this._functionVersions ||
|
||||
(0, functionVersion_1.FunctionVersionListInstance)(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._functionVersions;
|
||||
}
|
||||
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 FunctionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new FunctionInstance(operationVersion, response.body, instance._solution.serviceSid, 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["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 FunctionInstance(operationVersion, payload, instance._solution.serviceSid, 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["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 FunctionInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.FunctionContextImpl = FunctionContextImpl;
|
||||
class FunctionInstance {
|
||||
constructor(_version, payload, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.friendlyName = payload.friendly_name;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { serviceSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new FunctionContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a FunctionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a FunctionInstance 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 FunctionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a FunctionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionInstance 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 functionVersions.
|
||||
*/
|
||||
functionVersions() {
|
||||
return this._proxy.functionVersions;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
friendlyName: this.friendlyName,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.FunctionInstance = FunctionInstance;
|
||||
function FunctionListInstance(version, serviceSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new FunctionContextImpl(version, serviceSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid };
|
||||
instance._uri = `/Services/${serviceSid}/Functions`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 FunctionInstance(operationVersion, payload, instance._solution.serviceSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["friendlyName"] === null ||
|
||||
params["friendlyName"] === undefined) {
|
||||
throw new Error("Required parameter \"params['friendlyName']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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 FunctionInstance(operationVersion, response.body, instance._solution.serviceSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["pageSize"] !== undefined)
|
||||
data["PageSize"] = params["pageSize"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.page({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new FunctionPage(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 FunctionPage(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 FunctionPage(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 FunctionPage(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 FunctionPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the FunctionPage
|
||||
*
|
||||
* @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 FunctionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new FunctionInstance(this._version, payload, this._solution.serviceSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.FunctionPage = FunctionPage;
|
||||
314
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion.d.ts
generated
vendored
Normal file
314
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
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 { FunctionVersionContentListInstance } from "./functionVersion/functionVersionContent";
|
||||
/**
|
||||
* The access control that determines how the Function Version resource can be accessed. Can be: `public`, `protected`, or `private`.
|
||||
*/
|
||||
export type FunctionVersionVisibility = "public" | "private" | "protected";
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface FunctionVersionListInstanceEachOptions {
|
||||
/** 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: FunctionVersionInstance, 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 FunctionVersionListInstanceOptions {
|
||||
/** 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 FunctionVersionListInstancePageOptions {
|
||||
/** 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 FunctionVersionContext {
|
||||
functionVersionContent: FunctionVersionContentListInstance;
|
||||
/**
|
||||
* Fetch a FunctionVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: FunctionVersionInstance) => any): Promise<FunctionVersionInstance>;
|
||||
/**
|
||||
* Fetch a FunctionVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionVersionInstance>) => any): Promise<ApiResponse<FunctionVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface FunctionVersionContextSolution {
|
||||
serviceSid: string;
|
||||
functionSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class FunctionVersionContextImpl implements FunctionVersionContext {
|
||||
protected _version: V1;
|
||||
protected _solution: FunctionVersionContextSolution;
|
||||
protected _uri: string;
|
||||
protected _functionVersionContent?: FunctionVersionContentListInstance;
|
||||
constructor(_version: V1, serviceSid: string, functionSid: string, sid: string);
|
||||
get functionVersionContent(): FunctionVersionContentListInstance;
|
||||
fetch(callback?: (error: Error | null, item?: FunctionVersionInstance) => any): Promise<FunctionVersionInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionVersionInstance>) => any): Promise<ApiResponse<FunctionVersionInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): FunctionVersionContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface FunctionVersionPayload extends TwilioResponsePayload {
|
||||
function_versions: FunctionVersionResource[];
|
||||
}
|
||||
interface FunctionVersionResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
function_sid: string;
|
||||
path: string;
|
||||
visibility: FunctionVersionVisibility;
|
||||
date_created: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class FunctionVersionInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: FunctionVersionContextSolution;
|
||||
protected _context?: FunctionVersionContext;
|
||||
constructor(_version: V1, payload: FunctionVersionResource, serviceSid: string, functionSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Function Version resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Function Version resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the Function resource that is the parent of the Function Version resource.
|
||||
*/
|
||||
functionSid: string;
|
||||
/**
|
||||
* The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (\'/\'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.
|
||||
*/
|
||||
path: string;
|
||||
visibility: FunctionVersionVisibility;
|
||||
/**
|
||||
* The date and time in GMT when the Function Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The absolute URL of the Function Version resource.
|
||||
*/
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a FunctionVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: FunctionVersionInstance) => any): Promise<FunctionVersionInstance>;
|
||||
/**
|
||||
* Fetch a FunctionVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionVersionInstance>) => any): Promise<ApiResponse<FunctionVersionInstance>>;
|
||||
/**
|
||||
* Access the functionVersionContent.
|
||||
*/
|
||||
functionVersionContent(): FunctionVersionContentListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
functionSid: string;
|
||||
path: string;
|
||||
visibility: FunctionVersionVisibility;
|
||||
dateCreated: Date;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface FunctionVersionSolution {
|
||||
serviceSid: string;
|
||||
functionSid: string;
|
||||
}
|
||||
export interface FunctionVersionListInstance {
|
||||
_version: V1;
|
||||
_solution: FunctionVersionSolution;
|
||||
_uri: string;
|
||||
(sid: string): FunctionVersionContext;
|
||||
get(sid: string): FunctionVersionContext;
|
||||
/**
|
||||
* Streams FunctionVersionInstance 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 { FunctionVersionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: FunctionVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: FunctionVersionListInstanceEachOptions, callback?: (item: FunctionVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams FunctionVersionInstance 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 { FunctionVersionListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: FunctionVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: FunctionVersionListInstanceEachOptions, callback?: (item: FunctionVersionInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of FunctionVersionInstance 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: FunctionVersionPage) => any): Promise<FunctionVersionPage>;
|
||||
/**
|
||||
* Retrieve a single target page of FunctionVersionInstance 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<FunctionVersionPage>) => any): Promise<ApiResponse<FunctionVersionPage>>;
|
||||
/**
|
||||
* Lists FunctionVersionInstance 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 { FunctionVersionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: FunctionVersionInstance[]) => any): Promise<FunctionVersionInstance[]>;
|
||||
list(params: FunctionVersionListInstanceOptions, callback?: (error: Error | null, items: FunctionVersionInstance[]) => any): Promise<FunctionVersionInstance[]>;
|
||||
/**
|
||||
* Lists FunctionVersionInstance 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 { FunctionVersionListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FunctionVersionInstance[]>) => any): Promise<ApiResponse<FunctionVersionInstance[]>>;
|
||||
listWithHttpInfo(params: FunctionVersionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FunctionVersionInstance[]>) => any): Promise<ApiResponse<FunctionVersionInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of FunctionVersionInstance 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 { FunctionVersionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: FunctionVersionPage) => any): Promise<FunctionVersionPage>;
|
||||
page(params: FunctionVersionListInstancePageOptions, callback?: (error: Error | null, items: FunctionVersionPage) => any): Promise<FunctionVersionPage>;
|
||||
/**
|
||||
* Retrieve a single page of FunctionVersionInstance 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 { FunctionVersionListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FunctionVersionPage>) => any): Promise<ApiResponse<FunctionVersionPage>>;
|
||||
pageWithHttpInfo(params: FunctionVersionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FunctionVersionPage>) => any): Promise<ApiResponse<FunctionVersionPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function FunctionVersionListInstance(version: V1, serviceSid: string, functionSid: string): FunctionVersionListInstance;
|
||||
export declare class FunctionVersionPage extends Page<V1, FunctionVersionPayload, FunctionVersionResource, FunctionVersionInstance> {
|
||||
/**
|
||||
* Initialize the FunctionVersionPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: FunctionVersionSolution);
|
||||
/**
|
||||
* Build an instance of FunctionVersionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: FunctionVersionResource): FunctionVersionInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
293
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion.js
generated
vendored
Normal file
293
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion.js
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.FunctionVersionPage = exports.FunctionVersionInstance = exports.FunctionVersionContextImpl = void 0;
|
||||
exports.FunctionVersionListInstance = FunctionVersionListInstance;
|
||||
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 functionVersionContent_1 = require("./functionVersion/functionVersionContent");
|
||||
class FunctionVersionContextImpl {
|
||||
constructor(_version, serviceSid, functionSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(functionSid)) {
|
||||
throw new Error("Parameter 'functionSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, functionSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Functions/${functionSid}/Versions/${sid}`;
|
||||
}
|
||||
get functionVersionContent() {
|
||||
this._functionVersionContent =
|
||||
this._functionVersionContent ||
|
||||
(0, functionVersionContent_1.FunctionVersionContentListInstance)(this._version, this._solution.serviceSid, this._solution.functionSid, this._solution.sid);
|
||||
return this._functionVersionContent;
|
||||
}
|
||||
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 FunctionVersionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.functionSid, 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 FunctionVersionInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.functionSid, 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.FunctionVersionContextImpl = FunctionVersionContextImpl;
|
||||
class FunctionVersionInstance {
|
||||
constructor(_version, payload, serviceSid, functionSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.functionSid = payload.function_sid;
|
||||
this.path = payload.path;
|
||||
this.visibility = payload.visibility;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { serviceSid, functionSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new FunctionVersionContextImpl(this._version, this._solution.serviceSid, this._solution.functionSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a FunctionVersionInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a FunctionVersionInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Access the functionVersionContent.
|
||||
*/
|
||||
functionVersionContent() {
|
||||
return this._proxy.functionVersionContent;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
functionSid: this.functionSid,
|
||||
path: this.path,
|
||||
visibility: this.visibility,
|
||||
dateCreated: this.dateCreated,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.FunctionVersionInstance = FunctionVersionInstance;
|
||||
function FunctionVersionListInstance(version, serviceSid, functionSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(functionSid)) {
|
||||
throw new Error("Parameter 'functionSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new FunctionVersionContextImpl(version, serviceSid, functionSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, functionSid };
|
||||
instance._uri = `/Services/${serviceSid}/Functions/${functionSid}/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 FunctionVersionPage(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 FunctionVersionPage(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 FunctionVersionPage(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 FunctionVersionPage(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 FunctionVersionPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the FunctionVersionPage
|
||||
*
|
||||
* @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 FunctionVersionInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new FunctionVersionInstance(this._version, payload, this._solution.serviceSid, this._solution.functionSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.FunctionVersionPage = FunctionVersionPage;
|
||||
131
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion/functionVersionContent.d.ts
generated
vendored
Normal file
131
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion/functionVersionContent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../../../../V1";
|
||||
import { ApiResponse } from "../../../../../../base/ApiResponse";
|
||||
export interface FunctionVersionContentContext {
|
||||
/**
|
||||
* Fetch a FunctionVersionContentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionContentInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: FunctionVersionContentInstance) => any): Promise<FunctionVersionContentInstance>;
|
||||
/**
|
||||
* Fetch a FunctionVersionContentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionContentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionVersionContentInstance>) => any): Promise<ApiResponse<FunctionVersionContentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface FunctionVersionContentContextSolution {
|
||||
serviceSid: string;
|
||||
functionSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class FunctionVersionContentContextImpl implements FunctionVersionContentContext {
|
||||
protected _version: V1;
|
||||
protected _solution: FunctionVersionContentContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, functionSid: string, sid: string);
|
||||
fetch(callback?: (error: Error | null, item?: FunctionVersionContentInstance) => any): Promise<FunctionVersionContentInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionVersionContentInstance>) => any): Promise<ApiResponse<FunctionVersionContentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): FunctionVersionContentContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface FunctionVersionContentResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
function_sid: string;
|
||||
content: string;
|
||||
url: string;
|
||||
}
|
||||
export declare class FunctionVersionContentInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: FunctionVersionContentContextSolution;
|
||||
protected _context?: FunctionVersionContentContext;
|
||||
constructor(_version: V1, payload: FunctionVersionContentResource, serviceSid: string, functionSid: string, sid: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Function Version resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the Service that the Function Version resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the Function that is the parent of the Function Version.
|
||||
*/
|
||||
functionSid: string;
|
||||
/**
|
||||
* The content of the Function Version resource.
|
||||
*/
|
||||
content: string;
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a FunctionVersionContentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionContentInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: FunctionVersionContentInstance) => any): Promise<FunctionVersionContentInstance>;
|
||||
/**
|
||||
* Fetch a FunctionVersionContentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionContentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FunctionVersionContentInstance>) => any): Promise<ApiResponse<FunctionVersionContentInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
functionSid: string;
|
||||
content: string;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface FunctionVersionContentSolution {
|
||||
serviceSid: string;
|
||||
functionSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export interface FunctionVersionContentListInstance {
|
||||
_version: V1;
|
||||
_solution: FunctionVersionContentSolution;
|
||||
_uri: string;
|
||||
(): FunctionVersionContentContext;
|
||||
get(): FunctionVersionContentContext;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function FunctionVersionContentListInstance(version: V1, serviceSid: string, functionSid: string, sid: string): FunctionVersionContentListInstance;
|
||||
export {};
|
||||
163
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion/functionVersionContent.js
generated
vendored
Normal file
163
node_modules/twilio/lib/rest/serverless/v1/service/function/functionVersion/functionVersionContent.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Serverless
|
||||
* 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.FunctionVersionContentInstance = exports.FunctionVersionContentContextImpl = void 0;
|
||||
exports.FunctionVersionContentListInstance = FunctionVersionContentListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../../../../base/deserialize");
|
||||
const serialize = require("../../../../../../base/serialize");
|
||||
const utility_1 = require("../../../../../../base/utility");
|
||||
class FunctionVersionContentContextImpl {
|
||||
constructor(_version, serviceSid, functionSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(functionSid)) {
|
||||
throw new Error("Parameter 'functionSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { serviceSid, functionSid, sid };
|
||||
this._uri = `/Services/${serviceSid}/Functions/${functionSid}/Versions/${sid}/Content`;
|
||||
}
|
||||
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 FunctionVersionContentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.functionSid, 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 FunctionVersionContentInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.functionSid, 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.FunctionVersionContentContextImpl = FunctionVersionContentContextImpl;
|
||||
class FunctionVersionContentInstance {
|
||||
constructor(_version, payload, serviceSid, functionSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.functionSid = payload.function_sid;
|
||||
this.content = payload.content;
|
||||
this.url = payload.url;
|
||||
this._solution = { serviceSid, functionSid, sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new FunctionVersionContentContextImpl(this._version, this._solution.serviceSid, this._solution.functionSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a FunctionVersionContentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionContentInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a FunctionVersionContentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed FunctionVersionContentInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
functionSid: this.functionSid,
|
||||
content: this.content,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.FunctionVersionContentInstance = FunctionVersionContentInstance;
|
||||
function FunctionVersionContentListInstance(version, serviceSid, functionSid, sid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(functionSid)) {
|
||||
throw new Error("Parameter 'functionSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
const instance = (() => instance.get());
|
||||
instance.get = function get() {
|
||||
return new FunctionVersionContentContextImpl(version, serviceSid, functionSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid, functionSid, sid };
|
||||
instance._uri = ``;
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
Reference in New Issue
Block a user