Auto-commit 2026-04-29 16:31
This commit is contained in:
20
node_modules/twilio/lib/rest/notify/V1.d.ts
generated
vendored
Normal file
20
node_modules/twilio/lib/rest/notify/V1.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import NotifyBase from "../NotifyBase";
|
||||
import Version from "../../base/Version";
|
||||
import { CredentialListInstance } from "./v1/credential";
|
||||
import { ServiceListInstance } from "./v1/service";
|
||||
export default class V1 extends Version {
|
||||
/**
|
||||
* Initialize the V1 version of Notify
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.Notify) domain
|
||||
*/
|
||||
constructor(domain: NotifyBase);
|
||||
/** credentials - { Twilio.Notify.V1.CredentialListInstance } resource */
|
||||
protected _credentials?: CredentialListInstance;
|
||||
/** services - { Twilio.Notify.V1.ServiceListInstance } resource */
|
||||
protected _services?: ServiceListInstance;
|
||||
/** Getter for credentials resource */
|
||||
get credentials(): CredentialListInstance;
|
||||
/** Getter for services resource */
|
||||
get services(): ServiceListInstance;
|
||||
}
|
||||
42
node_modules/twilio/lib/rest/notify/V1.js
generated
vendored
Normal file
42
node_modules/twilio/lib/rest/notify/V1.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Notify
|
||||
* 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 credential_1 = require("./v1/credential");
|
||||
const service_1 = require("./v1/service");
|
||||
class V1 extends Version_1.default {
|
||||
/**
|
||||
* Initialize the V1 version of Notify
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.Notify) domain
|
||||
*/
|
||||
constructor(domain) {
|
||||
super(domain, "v1");
|
||||
}
|
||||
/** Getter for credentials resource */
|
||||
get credentials() {
|
||||
this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this);
|
||||
return this._credentials;
|
||||
}
|
||||
/** Getter for services resource */
|
||||
get services() {
|
||||
this._services = this._services || (0, service_1.ServiceListInstance)(this);
|
||||
return this._services;
|
||||
}
|
||||
}
|
||||
exports.default = V1;
|
||||
457
node_modules/twilio/lib/rest/notify/v1/credential.d.ts
generated
vendored
Normal file
457
node_modules/twilio/lib/rest/notify/v1/credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,457 @@
|
||||
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 Credential type. Can be: `gcm`, `fcm`, or `apn`.
|
||||
*/
|
||||
export type CredentialPushService = "gcm" | "apn" | "fcm";
|
||||
/**
|
||||
* Options to pass to update a CredentialInstance
|
||||
*/
|
||||
export interface CredentialContextUpdateOptions {
|
||||
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
|
||||
friendlyName?: string;
|
||||
/** [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` */
|
||||
certificate?: string;
|
||||
/** [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` */
|
||||
privateKey?: string;
|
||||
/** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */
|
||||
sandbox?: boolean;
|
||||
/** [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */
|
||||
apiKey?: string;
|
||||
/** [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */
|
||||
secret?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a CredentialInstance
|
||||
*/
|
||||
export interface CredentialListInstanceCreateOptions {
|
||||
/** */
|
||||
type: CredentialPushService;
|
||||
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
|
||||
friendlyName?: string;
|
||||
/** [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` */
|
||||
certificate?: string;
|
||||
/** [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` */
|
||||
privateKey?: string;
|
||||
/** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */
|
||||
sandbox?: boolean;
|
||||
/** [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */
|
||||
apiKey?: string;
|
||||
/** [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */
|
||||
secret?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface CredentialListInstanceEachOptions {
|
||||
/** 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: CredentialInstance, 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 CredentialListInstanceOptions {
|
||||
/** 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 CredentialListInstancePageOptions {
|
||||
/** 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 CredentialContext {
|
||||
/**
|
||||
* Remove a CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a CredentialInstance 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 CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Fetch a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Update a CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Update a CredentialInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Update a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Update a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface CredentialContextSolution {
|
||||
sid: string;
|
||||
}
|
||||
export declare class CredentialContextImpl implements CredentialContext {
|
||||
protected _version: V1;
|
||||
protected _solution: CredentialContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, sid: string);
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
updateWithHttpInfo(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: ApiResponse<CredentialInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): CredentialContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface CredentialPayload extends TwilioResponsePayload {
|
||||
credentials: CredentialResource[];
|
||||
}
|
||||
interface CredentialResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
friendly_name: string;
|
||||
type: CredentialPushService;
|
||||
sandbox: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
url: string;
|
||||
}
|
||||
export declare class CredentialInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: CredentialContextSolution;
|
||||
protected _context?: CredentialContext;
|
||||
constructor(_version: V1, payload: CredentialResource, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Credential resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The string that you assigned to describe the resource.
|
||||
*/
|
||||
friendlyName: string;
|
||||
type: CredentialPushService;
|
||||
/**
|
||||
* [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production.
|
||||
*/
|
||||
sandbox: string;
|
||||
/**
|
||||
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The absolute URL of the Credential resource.
|
||||
*/
|
||||
url: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a CredentialInstance 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 CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Fetch a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Update a CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Update a CredentialInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Update a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Update a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
friendlyName: string;
|
||||
type: CredentialPushService;
|
||||
sandbox: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
url: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface CredentialSolution {
|
||||
}
|
||||
export interface CredentialListInstance {
|
||||
_version: V1;
|
||||
_solution: CredentialSolution;
|
||||
_uri: string;
|
||||
(sid: string): CredentialContext;
|
||||
get(sid: string): CredentialContext;
|
||||
/**
|
||||
* Create a CredentialInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>;
|
||||
/**
|
||||
* Create a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CredentialInstance>) => any): Promise<ApiResponse<CredentialInstance>>;
|
||||
/**
|
||||
* Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>;
|
||||
/**
|
||||
* Retrieve a single target page of CredentialInstance 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<CredentialPage>) => any): Promise<ApiResponse<CredentialPage>>;
|
||||
/**
|
||||
* Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>;
|
||||
list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>;
|
||||
/**
|
||||
* Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CredentialInstance[]>) => any): Promise<ApiResponse<CredentialInstance[]>>;
|
||||
listWithHttpInfo(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CredentialInstance[]>) => any): Promise<ApiResponse<CredentialInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>;
|
||||
page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>;
|
||||
/**
|
||||
* Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CredentialPage>) => any): Promise<ApiResponse<CredentialPage>>;
|
||||
pageWithHttpInfo(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CredentialPage>) => any): Promise<ApiResponse<CredentialPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function CredentialListInstance(version: V1): CredentialListInstance;
|
||||
export declare class CredentialPage extends Page<V1, CredentialPayload, CredentialResource, CredentialInstance> {
|
||||
/**
|
||||
* Initialize the CredentialPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: CredentialSolution);
|
||||
/**
|
||||
* Build an instance of CredentialInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: CredentialResource): CredentialInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
467
node_modules/twilio/lib/rest/notify/v1/credential.js
generated
vendored
Normal file
467
node_modules/twilio/lib/rest/notify/v1/credential.js
generated
vendored
Normal file
@@ -0,0 +1,467 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Notify
|
||||
* 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.CredentialPage = exports.CredentialInstance = exports.CredentialContextImpl = void 0;
|
||||
exports.CredentialListInstance = CredentialListInstance;
|
||||
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 CredentialContextImpl {
|
||||
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 = `/Credentials/${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 CredentialInstance(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 CredentialInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["certificate"] !== undefined)
|
||||
data["Certificate"] = params["certificate"];
|
||||
if (params["privateKey"] !== undefined)
|
||||
data["PrivateKey"] = params["privateKey"];
|
||||
if (params["sandbox"] !== undefined)
|
||||
data["Sandbox"] = serialize.bool(params["sandbox"]);
|
||||
if (params["apiKey"] !== undefined)
|
||||
data["ApiKey"] = params["apiKey"];
|
||||
if (params["secret"] !== undefined)
|
||||
data["Secret"] = params["secret"];
|
||||
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 CredentialInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["certificate"] !== undefined)
|
||||
data["Certificate"] = params["certificate"];
|
||||
if (params["privateKey"] !== undefined)
|
||||
data["PrivateKey"] = params["privateKey"];
|
||||
if (params["sandbox"] !== undefined)
|
||||
data["Sandbox"] = serialize.bool(params["sandbox"]);
|
||||
if (params["apiKey"] !== undefined)
|
||||
data["ApiKey"] = params["apiKey"];
|
||||
if (params["secret"] !== undefined)
|
||||
data["Secret"] = params["secret"];
|
||||
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 CredentialInstance(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.CredentialContextImpl = CredentialContextImpl;
|
||||
class CredentialInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.friendlyName = payload.friendly_name;
|
||||
this.type = payload.type;
|
||||
this.sandbox = payload.sandbox;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.url = payload.url;
|
||||
this._solution = { sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new CredentialContextImpl(this._version, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a CredentialInstance 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 CredentialInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a CredentialInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed CredentialInstance 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,
|
||||
friendlyName: this.friendlyName,
|
||||
type: this.type,
|
||||
sandbox: this.sandbox,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.CredentialInstance = CredentialInstance;
|
||||
function CredentialListInstance(version) {
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new CredentialContextImpl(version, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/Credentials`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["type"] === null || params["type"] === undefined) {
|
||||
throw new Error("Required parameter \"params['type']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Type"] = params["type"];
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["certificate"] !== undefined)
|
||||
data["Certificate"] = params["certificate"];
|
||||
if (params["privateKey"] !== undefined)
|
||||
data["PrivateKey"] = params["privateKey"];
|
||||
if (params["sandbox"] !== undefined)
|
||||
data["Sandbox"] = serialize.bool(params["sandbox"]);
|
||||
if (params["apiKey"] !== undefined)
|
||||
data["ApiKey"] = params["apiKey"];
|
||||
if (params["secret"] !== undefined)
|
||||
data["Secret"] = params["secret"];
|
||||
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 CredentialInstance(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["type"] === null || params["type"] === undefined) {
|
||||
throw new Error("Required parameter \"params['type']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Type"] = params["type"];
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["certificate"] !== undefined)
|
||||
data["Certificate"] = params["certificate"];
|
||||
if (params["privateKey"] !== undefined)
|
||||
data["PrivateKey"] = params["privateKey"];
|
||||
if (params["sandbox"] !== undefined)
|
||||
data["Sandbox"] = serialize.bool(params["sandbox"]);
|
||||
if (params["apiKey"] !== undefined)
|
||||
data["ApiKey"] = params["apiKey"];
|
||||
if (params["secret"] !== undefined)
|
||||
data["Secret"] = params["secret"];
|
||||
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 CredentialInstance(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 CredentialPage(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 CredentialPage(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 CredentialPage(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 CredentialPage(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 CredentialPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the CredentialPage
|
||||
*
|
||||
* @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 CredentialInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new CredentialInstance(this._version, payload);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.CredentialPage = CredentialPage;
|
||||
596
node_modules/twilio/lib/rest/notify/v1/service.d.ts
generated
vendored
Normal file
596
node_modules/twilio/lib/rest/notify/v1/service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,596 @@
|
||||
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 { BindingListInstance } from "./service/binding";
|
||||
import { NotificationListInstance } from "./service/notification";
|
||||
/**
|
||||
* Options to pass to update a ServiceInstance
|
||||
*/
|
||||
export interface ServiceContextUpdateOptions {
|
||||
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
|
||||
friendlyName?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. */
|
||||
apnCredentialSid?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. */
|
||||
gcmCredentialSid?: string;
|
||||
/** The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. */
|
||||
messagingServiceSid?: string;
|
||||
/** Deprecated. */
|
||||
facebookMessengerPageId?: string;
|
||||
/** The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */
|
||||
defaultApnNotificationProtocolVersion?: string;
|
||||
/** The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */
|
||||
defaultGcmNotificationProtocolVersion?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. */
|
||||
fcmCredentialSid?: string;
|
||||
/** The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */
|
||||
defaultFcmNotificationProtocolVersion?: string;
|
||||
/** Whether to log notifications. Can be: `true` or `false` and the default is `true`. */
|
||||
logEnabled?: boolean;
|
||||
/** Deprecated. */
|
||||
alexaSkillId?: string;
|
||||
/** Deprecated. */
|
||||
defaultAlexaNotificationProtocolVersion?: string;
|
||||
/** URL to send delivery status callback. */
|
||||
deliveryCallbackUrl?: string;
|
||||
/** Callback configuration that enables delivery callbacks, default false */
|
||||
deliveryCallbackEnabled?: boolean;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a ServiceInstance
|
||||
*/
|
||||
export interface ServiceListInstanceCreateOptions {
|
||||
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
|
||||
friendlyName?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. */
|
||||
apnCredentialSid?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. */
|
||||
gcmCredentialSid?: string;
|
||||
/** The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. */
|
||||
messagingServiceSid?: string;
|
||||
/** Deprecated. */
|
||||
facebookMessengerPageId?: string;
|
||||
/** The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */
|
||||
defaultApnNotificationProtocolVersion?: string;
|
||||
/** The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */
|
||||
defaultGcmNotificationProtocolVersion?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. */
|
||||
fcmCredentialSid?: string;
|
||||
/** The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */
|
||||
defaultFcmNotificationProtocolVersion?: string;
|
||||
/** Whether to log notifications. Can be: `true` or `false` and the default is `true`. */
|
||||
logEnabled?: boolean;
|
||||
/** Deprecated. */
|
||||
alexaSkillId?: string;
|
||||
/** Deprecated. */
|
||||
defaultAlexaNotificationProtocolVersion?: string;
|
||||
/** URL to send delivery status callback. */
|
||||
deliveryCallbackUrl?: string;
|
||||
/** Callback configuration that enables delivery callbacks, default false */
|
||||
deliveryCallbackEnabled?: boolean;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface ServiceListInstanceEachOptions {
|
||||
/** The string that identifies the Service resources to read. */
|
||||
friendlyName?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: 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 {
|
||||
/** The string that identifies the Service resources to read. */
|
||||
friendlyName?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to page
|
||||
*/
|
||||
export interface ServiceListInstancePageOptions {
|
||||
/** The string that identifies the Service resources to read. */
|
||||
friendlyName?: string;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface ServiceContext {
|
||||
bindings: BindingListInstance;
|
||||
notifications: NotificationListInstance;
|
||||
/**
|
||||
* 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 _bindings?: BindingListInstance;
|
||||
protected _notifications?: NotificationListInstance;
|
||||
constructor(_version: V1, sid: string);
|
||||
get bindings(): BindingListInstance;
|
||||
get notifications(): NotificationListInstance;
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
updateWithHttpInfo(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ApiResponse<ServiceInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): ServiceContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface ServicePayload extends TwilioResponsePayload {
|
||||
services: ServiceResource[];
|
||||
}
|
||||
interface ServiceResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
friendly_name: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
apn_credential_sid: string;
|
||||
gcm_credential_sid: string;
|
||||
fcm_credential_sid: string;
|
||||
messaging_service_sid: string;
|
||||
facebook_messenger_page_id: string;
|
||||
default_apn_notification_protocol_version: string;
|
||||
default_gcm_notification_protocol_version: string;
|
||||
default_fcm_notification_protocol_version: string;
|
||||
log_enabled: boolean;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
alexa_skill_id: string;
|
||||
default_alexa_notification_protocol_version: string;
|
||||
delivery_callback_url: string;
|
||||
delivery_callback_enabled: boolean;
|
||||
}
|
||||
export declare class ServiceInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: ServiceContextSolution;
|
||||
protected _context?: ServiceContext;
|
||||
constructor(_version: V1, payload: ServiceResource, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Service resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The string that you assigned to describe the resource.
|
||||
*/
|
||||
friendlyName: string;
|
||||
/**
|
||||
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings.
|
||||
*/
|
||||
apnCredentialSid: string;
|
||||
/**
|
||||
* The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings.
|
||||
*/
|
||||
gcmCredentialSid: string;
|
||||
/**
|
||||
* The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings.
|
||||
*/
|
||||
fcmCredentialSid: string;
|
||||
/**
|
||||
* The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set.
|
||||
*/
|
||||
messagingServiceSid: string;
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
facebookMessengerPageId: string;
|
||||
/**
|
||||
* The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource.
|
||||
*/
|
||||
defaultApnNotificationProtocolVersion: string;
|
||||
/**
|
||||
* The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource.
|
||||
*/
|
||||
defaultGcmNotificationProtocolVersion: string;
|
||||
/**
|
||||
* The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource.
|
||||
*/
|
||||
defaultFcmNotificationProtocolVersion: string;
|
||||
/**
|
||||
* Whether to log notifications. Can be: `true` or `false` and the default is `true`.
|
||||
*/
|
||||
logEnabled: boolean;
|
||||
/**
|
||||
* The absolute URL of the Service resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The URLs of the Binding, Notification, Segment, and User resources related to the service.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
alexaSkillId: string;
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
defaultAlexaNotificationProtocolVersion: string;
|
||||
/**
|
||||
* URL to send delivery status callback.
|
||||
*/
|
||||
deliveryCallbackUrl: string;
|
||||
/**
|
||||
* Callback configuration that enables delivery callbacks, default false
|
||||
*/
|
||||
deliveryCallbackEnabled: boolean;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Fetch a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Fetch a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Update a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Update a ServiceInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* Update a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Update a ServiceInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
|
||||
/**
|
||||
* Access the bindings.
|
||||
*/
|
||||
bindings(): BindingListInstance;
|
||||
/**
|
||||
* Access the notifications.
|
||||
*/
|
||||
notifications(): NotificationListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
friendlyName: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
apnCredentialSid: string;
|
||||
gcmCredentialSid: string;
|
||||
fcmCredentialSid: string;
|
||||
messagingServiceSid: string;
|
||||
facebookMessengerPageId: string;
|
||||
defaultApnNotificationProtocolVersion: string;
|
||||
defaultGcmNotificationProtocolVersion: string;
|
||||
defaultFcmNotificationProtocolVersion: string;
|
||||
logEnabled: boolean;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
alexaSkillId: string;
|
||||
defaultAlexaNotificationProtocolVersion: string;
|
||||
deliveryCallbackUrl: string;
|
||||
deliveryCallbackEnabled: boolean;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface ServiceSolution {
|
||||
}
|
||||
export interface ServiceListInstance {
|
||||
_version: V1;
|
||||
_solution: ServiceSolution;
|
||||
_uri: string;
|
||||
(sid: string): ServiceContext;
|
||||
get(sid: string): ServiceContext;
|
||||
/**
|
||||
* Create a ServiceInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance
|
||||
*/
|
||||
create(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
|
||||
/**
|
||||
* 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 callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed ServiceInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<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 {};
|
||||
604
node_modules/twilio/lib/rest/notify/v1/service.js
generated
vendored
Normal file
604
node_modules/twilio/lib/rest/notify/v1/service.js
generated
vendored
Normal file
@@ -0,0 +1,604 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Notify
|
||||
* 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 binding_1 = require("./service/binding");
|
||||
const notification_1 = require("./service/notification");
|
||||
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 bindings() {
|
||||
this._bindings =
|
||||
this._bindings || (0, binding_1.BindingListInstance)(this._version, this._solution.sid);
|
||||
return this._bindings;
|
||||
}
|
||||
get notifications() {
|
||||
this._notifications =
|
||||
this._notifications ||
|
||||
(0, notification_1.NotificationListInstance)(this._version, this._solution.sid);
|
||||
return this._notifications;
|
||||
}
|
||||
remove(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
||||
uri: instance._uri,
|
||||
method: "delete",
|
||||
headers,
|
||||
});
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
removeWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// DELETE operation - returns boolean based on status code
|
||||
let operationPromise = operationVersion
|
||||
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: response.statusCode === 204,
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetch(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new ServiceInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["apnCredentialSid"] !== undefined)
|
||||
data["ApnCredentialSid"] = params["apnCredentialSid"];
|
||||
if (params["gcmCredentialSid"] !== undefined)
|
||||
data["GcmCredentialSid"] = params["gcmCredentialSid"];
|
||||
if (params["messagingServiceSid"] !== undefined)
|
||||
data["MessagingServiceSid"] = params["messagingServiceSid"];
|
||||
if (params["facebookMessengerPageId"] !== undefined)
|
||||
data["FacebookMessengerPageId"] = params["facebookMessengerPageId"];
|
||||
if (params["defaultApnNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultApnNotificationProtocolVersion"] =
|
||||
params["defaultApnNotificationProtocolVersion"];
|
||||
if (params["defaultGcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultGcmNotificationProtocolVersion"] =
|
||||
params["defaultGcmNotificationProtocolVersion"];
|
||||
if (params["fcmCredentialSid"] !== undefined)
|
||||
data["FcmCredentialSid"] = params["fcmCredentialSid"];
|
||||
if (params["defaultFcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultFcmNotificationProtocolVersion"] =
|
||||
params["defaultFcmNotificationProtocolVersion"];
|
||||
if (params["logEnabled"] !== undefined)
|
||||
data["LogEnabled"] = serialize.bool(params["logEnabled"]);
|
||||
if (params["alexaSkillId"] !== undefined)
|
||||
data["AlexaSkillId"] = params["alexaSkillId"];
|
||||
if (params["defaultAlexaNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultAlexaNotificationProtocolVersion"] =
|
||||
params["defaultAlexaNotificationProtocolVersion"];
|
||||
if (params["deliveryCallbackUrl"] !== undefined)
|
||||
data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"];
|
||||
if (params["deliveryCallbackEnabled"] !== undefined)
|
||||
data["DeliveryCallbackEnabled"] = serialize.bool(params["deliveryCallbackEnabled"]);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["apnCredentialSid"] !== undefined)
|
||||
data["ApnCredentialSid"] = params["apnCredentialSid"];
|
||||
if (params["gcmCredentialSid"] !== undefined)
|
||||
data["GcmCredentialSid"] = params["gcmCredentialSid"];
|
||||
if (params["messagingServiceSid"] !== undefined)
|
||||
data["MessagingServiceSid"] = params["messagingServiceSid"];
|
||||
if (params["facebookMessengerPageId"] !== undefined)
|
||||
data["FacebookMessengerPageId"] = params["facebookMessengerPageId"];
|
||||
if (params["defaultApnNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultApnNotificationProtocolVersion"] =
|
||||
params["defaultApnNotificationProtocolVersion"];
|
||||
if (params["defaultGcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultGcmNotificationProtocolVersion"] =
|
||||
params["defaultGcmNotificationProtocolVersion"];
|
||||
if (params["fcmCredentialSid"] !== undefined)
|
||||
data["FcmCredentialSid"] = params["fcmCredentialSid"];
|
||||
if (params["defaultFcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultFcmNotificationProtocolVersion"] =
|
||||
params["defaultFcmNotificationProtocolVersion"];
|
||||
if (params["logEnabled"] !== undefined)
|
||||
data["LogEnabled"] = serialize.bool(params["logEnabled"]);
|
||||
if (params["alexaSkillId"] !== undefined)
|
||||
data["AlexaSkillId"] = params["alexaSkillId"];
|
||||
if (params["defaultAlexaNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultAlexaNotificationProtocolVersion"] =
|
||||
params["defaultAlexaNotificationProtocolVersion"];
|
||||
if (params["deliveryCallbackUrl"] !== undefined)
|
||||
data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"];
|
||||
if (params["deliveryCallbackEnabled"] !== undefined)
|
||||
data["DeliveryCallbackEnabled"] = serialize.bool(params["deliveryCallbackEnabled"]);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.updateWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new ServiceInstance(operationVersion, response.body, instance._solution.sid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return this._solution;
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.ServiceContextImpl = ServiceContextImpl;
|
||||
class ServiceInstance {
|
||||
constructor(_version, payload, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.friendlyName = payload.friendly_name;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.apnCredentialSid = payload.apn_credential_sid;
|
||||
this.gcmCredentialSid = payload.gcm_credential_sid;
|
||||
this.fcmCredentialSid = payload.fcm_credential_sid;
|
||||
this.messagingServiceSid = payload.messaging_service_sid;
|
||||
this.facebookMessengerPageId = payload.facebook_messenger_page_id;
|
||||
this.defaultApnNotificationProtocolVersion =
|
||||
payload.default_apn_notification_protocol_version;
|
||||
this.defaultGcmNotificationProtocolVersion =
|
||||
payload.default_gcm_notification_protocol_version;
|
||||
this.defaultFcmNotificationProtocolVersion =
|
||||
payload.default_fcm_notification_protocol_version;
|
||||
this.logEnabled = payload.log_enabled;
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this.alexaSkillId = payload.alexa_skill_id;
|
||||
this.defaultAlexaNotificationProtocolVersion =
|
||||
payload.default_alexa_notification_protocol_version;
|
||||
this.deliveryCallbackUrl = payload.delivery_callback_url;
|
||||
this.deliveryCallbackEnabled = payload.delivery_callback_enabled;
|
||||
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 bindings.
|
||||
*/
|
||||
bindings() {
|
||||
return this._proxy.bindings;
|
||||
}
|
||||
/**
|
||||
* Access the notifications.
|
||||
*/
|
||||
notifications() {
|
||||
return this._proxy.notifications;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
friendlyName: this.friendlyName,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
apnCredentialSid: this.apnCredentialSid,
|
||||
gcmCredentialSid: this.gcmCredentialSid,
|
||||
fcmCredentialSid: this.fcmCredentialSid,
|
||||
messagingServiceSid: this.messagingServiceSid,
|
||||
facebookMessengerPageId: this.facebookMessengerPageId,
|
||||
defaultApnNotificationProtocolVersion: this.defaultApnNotificationProtocolVersion,
|
||||
defaultGcmNotificationProtocolVersion: this.defaultGcmNotificationProtocolVersion,
|
||||
defaultFcmNotificationProtocolVersion: this.defaultFcmNotificationProtocolVersion,
|
||||
logEnabled: this.logEnabled,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
alexaSkillId: this.alexaSkillId,
|
||||
defaultAlexaNotificationProtocolVersion: this.defaultAlexaNotificationProtocolVersion,
|
||||
deliveryCallbackUrl: this.deliveryCallbackUrl,
|
||||
deliveryCallbackEnabled: this.deliveryCallbackEnabled,
|
||||
};
|
||||
}
|
||||
[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 instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["apnCredentialSid"] !== undefined)
|
||||
data["ApnCredentialSid"] = params["apnCredentialSid"];
|
||||
if (params["gcmCredentialSid"] !== undefined)
|
||||
data["GcmCredentialSid"] = params["gcmCredentialSid"];
|
||||
if (params["messagingServiceSid"] !== undefined)
|
||||
data["MessagingServiceSid"] = params["messagingServiceSid"];
|
||||
if (params["facebookMessengerPageId"] !== undefined)
|
||||
data["FacebookMessengerPageId"] = params["facebookMessengerPageId"];
|
||||
if (params["defaultApnNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultApnNotificationProtocolVersion"] =
|
||||
params["defaultApnNotificationProtocolVersion"];
|
||||
if (params["defaultGcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultGcmNotificationProtocolVersion"] =
|
||||
params["defaultGcmNotificationProtocolVersion"];
|
||||
if (params["fcmCredentialSid"] !== undefined)
|
||||
data["FcmCredentialSid"] = params["fcmCredentialSid"];
|
||||
if (params["defaultFcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultFcmNotificationProtocolVersion"] =
|
||||
params["defaultFcmNotificationProtocolVersion"];
|
||||
if (params["logEnabled"] !== undefined)
|
||||
data["LogEnabled"] = serialize.bool(params["logEnabled"]);
|
||||
if (params["alexaSkillId"] !== undefined)
|
||||
data["AlexaSkillId"] = params["alexaSkillId"];
|
||||
if (params["defaultAlexaNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultAlexaNotificationProtocolVersion"] =
|
||||
params["defaultAlexaNotificationProtocolVersion"];
|
||||
if (params["deliveryCallbackUrl"] !== undefined)
|
||||
data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"];
|
||||
if (params["deliveryCallbackEnabled"] !== undefined)
|
||||
data["DeliveryCallbackEnabled"] = serialize.bool(params["deliveryCallbackEnabled"]);
|
||||
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 instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
if (params["apnCredentialSid"] !== undefined)
|
||||
data["ApnCredentialSid"] = params["apnCredentialSid"];
|
||||
if (params["gcmCredentialSid"] !== undefined)
|
||||
data["GcmCredentialSid"] = params["gcmCredentialSid"];
|
||||
if (params["messagingServiceSid"] !== undefined)
|
||||
data["MessagingServiceSid"] = params["messagingServiceSid"];
|
||||
if (params["facebookMessengerPageId"] !== undefined)
|
||||
data["FacebookMessengerPageId"] = params["facebookMessengerPageId"];
|
||||
if (params["defaultApnNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultApnNotificationProtocolVersion"] =
|
||||
params["defaultApnNotificationProtocolVersion"];
|
||||
if (params["defaultGcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultGcmNotificationProtocolVersion"] =
|
||||
params["defaultGcmNotificationProtocolVersion"];
|
||||
if (params["fcmCredentialSid"] !== undefined)
|
||||
data["FcmCredentialSid"] = params["fcmCredentialSid"];
|
||||
if (params["defaultFcmNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultFcmNotificationProtocolVersion"] =
|
||||
params["defaultFcmNotificationProtocolVersion"];
|
||||
if (params["logEnabled"] !== undefined)
|
||||
data["LogEnabled"] = serialize.bool(params["logEnabled"]);
|
||||
if (params["alexaSkillId"] !== undefined)
|
||||
data["AlexaSkillId"] = params["alexaSkillId"];
|
||||
if (params["defaultAlexaNotificationProtocolVersion"] !== undefined)
|
||||
data["DefaultAlexaNotificationProtocolVersion"] =
|
||||
params["defaultAlexaNotificationProtocolVersion"];
|
||||
if (params["deliveryCallbackUrl"] !== undefined)
|
||||
data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"];
|
||||
if (params["deliveryCallbackEnabled"] !== undefined)
|
||||
data["DeliveryCallbackEnabled"] = serialize.bool(params["deliveryCallbackEnabled"]);
|
||||
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["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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["friendlyName"] !== undefined)
|
||||
data["FriendlyName"] = params["friendlyName"];
|
||||
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;
|
||||
435
node_modules/twilio/lib/rest/notify/v1/service/binding.d.ts
generated
vendored
Normal file
435
node_modules/twilio/lib/rest/notify/v1/service/binding.d.ts
generated
vendored
Normal file
@@ -0,0 +1,435 @@
|
||||
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 transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`.
|
||||
*/
|
||||
export type BindingBindingType = "apn" | "gcm" | "sms" | "fcm" | "facebook-messenger" | "alexa";
|
||||
/**
|
||||
* Options to pass to create a BindingInstance
|
||||
*/
|
||||
export interface BindingListInstanceCreateOptions {
|
||||
/** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. */
|
||||
identity: string;
|
||||
/** */
|
||||
bindingType: BindingBindingType;
|
||||
/** The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. */
|
||||
address: string;
|
||||
/** A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags. */
|
||||
tag?: Array<string>;
|
||||
/** The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `\\\"3\\\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. */
|
||||
notificationProtocolVersion?: string;
|
||||
/** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings. */
|
||||
credentialSid?: string;
|
||||
/** Deprecated. */
|
||||
endpoint?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface BindingListInstanceEachOptions {
|
||||
/** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. */
|
||||
startDate?: Date;
|
||||
/** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. */
|
||||
endDate?: Date;
|
||||
/** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. */
|
||||
identity?: Array<string>;
|
||||
/** Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. */
|
||||
tag?: Array<string>;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: BindingInstance, 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 BindingListInstanceOptions {
|
||||
/** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. */
|
||||
startDate?: Date;
|
||||
/** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. */
|
||||
endDate?: Date;
|
||||
/** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. */
|
||||
identity?: Array<string>;
|
||||
/** Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. */
|
||||
tag?: Array<string>;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Options to pass to page
|
||||
*/
|
||||
export interface BindingListInstancePageOptions {
|
||||
/** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. */
|
||||
startDate?: Date;
|
||||
/** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. */
|
||||
endDate?: Date;
|
||||
/** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. */
|
||||
identity?: Array<string>;
|
||||
/** Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. */
|
||||
tag?: Array<string>;
|
||||
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface BindingContext {
|
||||
/**
|
||||
* Remove a BindingInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a BindingInstance 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 BindingInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>;
|
||||
/**
|
||||
* Fetch a BindingInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BindingInstance>) => any): Promise<ApiResponse<BindingInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface BindingContextSolution {
|
||||
serviceSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class BindingContextImpl implements BindingContext {
|
||||
protected _version: V1;
|
||||
protected _solution: BindingContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: V1, serviceSid: string, sid: string);
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BindingInstance>) => any): Promise<ApiResponse<BindingInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): BindingContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface BindingPayload extends TwilioResponsePayload {
|
||||
bindings: BindingResource[];
|
||||
}
|
||||
interface BindingResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
credential_sid: string;
|
||||
date_created: Date;
|
||||
date_updated: Date;
|
||||
notification_protocol_version: string;
|
||||
endpoint: string;
|
||||
identity: string;
|
||||
binding_type: string;
|
||||
address: string;
|
||||
tags: Array<string>;
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
}
|
||||
export declare class BindingInstance {
|
||||
protected _version: V1;
|
||||
protected _solution: BindingContextSolution;
|
||||
protected _context?: BindingContext;
|
||||
constructor(_version: V1, payload: BindingResource, serviceSid: string, sid?: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Binding resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to `apn`, `fcm`, and `gcm` type Bindings.
|
||||
*/
|
||||
credentialSid: string;
|
||||
/**
|
||||
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateUpdated: Date;
|
||||
/**
|
||||
* The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` in the [Service](https://www.twilio.com/docs/notify/api/service-resource) for the protocol. The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed.
|
||||
*/
|
||||
notificationProtocolVersion: string;
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
endpoint: string;
|
||||
/**
|
||||
* The `identity` value that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service.
|
||||
*/
|
||||
identity: string;
|
||||
/**
|
||||
* The transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`.
|
||||
*/
|
||||
bindingType: string;
|
||||
/**
|
||||
* The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format.
|
||||
*/
|
||||
address: string;
|
||||
/**
|
||||
* The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed.
|
||||
*/
|
||||
tags: Array<string>;
|
||||
/**
|
||||
* The absolute URL of the Binding resource.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The URLs of related resources.
|
||||
*/
|
||||
links: Record<string, string>;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a BindingInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a BindingInstance 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 BindingInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>;
|
||||
/**
|
||||
* Fetch a BindingInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BindingInstance>) => any): Promise<ApiResponse<BindingInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
credentialSid: string;
|
||||
dateCreated: Date;
|
||||
dateUpdated: Date;
|
||||
notificationProtocolVersion: string;
|
||||
endpoint: string;
|
||||
identity: string;
|
||||
bindingType: string;
|
||||
address: string;
|
||||
tags: string[];
|
||||
url: string;
|
||||
links: Record<string, string>;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface BindingSolution {
|
||||
serviceSid: string;
|
||||
}
|
||||
export interface BindingListInstance {
|
||||
_version: V1;
|
||||
_solution: BindingSolution;
|
||||
_uri: string;
|
||||
(sid: string): BindingContext;
|
||||
get(sid: string): BindingContext;
|
||||
/**
|
||||
* Create a BindingInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance
|
||||
*/
|
||||
create(params: BindingListInstanceCreateOptions, callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>;
|
||||
/**
|
||||
* Create a BindingInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: BindingListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<BindingInstance>) => any): Promise<ApiResponse<BindingInstance>>;
|
||||
/**
|
||||
* Streams BindingInstance 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 { BindingListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: BindingListInstanceEachOptions, callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams BindingInstance 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 { BindingListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: BindingListInstanceEachOptions, callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of BindingInstance 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: BindingPage) => any): Promise<BindingPage>;
|
||||
/**
|
||||
* Retrieve a single target page of BindingInstance 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<BindingPage>) => any): Promise<ApiResponse<BindingPage>>;
|
||||
/**
|
||||
* Lists BindingInstance 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 { BindingListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>;
|
||||
list(params: BindingListInstanceOptions, callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>;
|
||||
/**
|
||||
* Lists BindingInstance 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 { BindingListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BindingInstance[]>) => any): Promise<ApiResponse<BindingInstance[]>>;
|
||||
listWithHttpInfo(params: BindingListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<BindingInstance[]>) => any): Promise<ApiResponse<BindingInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of BindingInstance 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 { BindingListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>;
|
||||
page(params: BindingListInstancePageOptions, callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>;
|
||||
/**
|
||||
* Retrieve a single page of BindingInstance 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 { BindingListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BindingPage>) => any): Promise<ApiResponse<BindingPage>>;
|
||||
pageWithHttpInfo(params: BindingListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<BindingPage>) => any): Promise<ApiResponse<BindingPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function BindingListInstance(version: V1, serviceSid: string): BindingListInstance;
|
||||
export declare class BindingPage extends Page<V1, BindingPayload, BindingResource, BindingInstance> {
|
||||
/**
|
||||
* Initialize the BindingPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: V1, response: Response<string>, solution: BindingSolution);
|
||||
/**
|
||||
* Build an instance of BindingInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: BindingResource): BindingInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
429
node_modules/twilio/lib/rest/notify/v1/service/binding.js
generated
vendored
Normal file
429
node_modules/twilio/lib/rest/notify/v1/service/binding.js
generated
vendored
Normal file
@@ -0,0 +1,429 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Notify
|
||||
* 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.BindingPage = exports.BindingInstance = exports.BindingContextImpl = void 0;
|
||||
exports.BindingListInstance = BindingListInstance;
|
||||
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 BindingContextImpl {
|
||||
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}/Bindings/${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 BindingInstance(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 BindingInstance(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.BindingContextImpl = BindingContextImpl;
|
||||
class BindingInstance {
|
||||
constructor(_version, payload, serviceSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.credentialSid = payload.credential_sid;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
||||
this.notificationProtocolVersion = payload.notification_protocol_version;
|
||||
this.endpoint = payload.endpoint;
|
||||
this.identity = payload.identity;
|
||||
this.bindingType = payload.binding_type;
|
||||
this.address = payload.address;
|
||||
this.tags = payload.tags;
|
||||
this.url = payload.url;
|
||||
this.links = payload.links;
|
||||
this._solution = { serviceSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new BindingContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a BindingInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a BindingInstance 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 BindingInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a BindingInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed BindingInstance 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,
|
||||
credentialSid: this.credentialSid,
|
||||
dateCreated: this.dateCreated,
|
||||
dateUpdated: this.dateUpdated,
|
||||
notificationProtocolVersion: this.notificationProtocolVersion,
|
||||
endpoint: this.endpoint,
|
||||
identity: this.identity,
|
||||
bindingType: this.bindingType,
|
||||
address: this.address,
|
||||
tags: this.tags,
|
||||
url: this.url,
|
||||
links: this.links,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BindingInstance = BindingInstance;
|
||||
function BindingListInstance(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 BindingContextImpl(version, serviceSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid };
|
||||
instance._uri = `/Services/${serviceSid}/Bindings`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["identity"] === null || params["identity"] === undefined) {
|
||||
throw new Error("Required parameter \"params['identity']\" missing.");
|
||||
}
|
||||
if (params["bindingType"] === null || params["bindingType"] === undefined) {
|
||||
throw new Error("Required parameter \"params['bindingType']\" missing.");
|
||||
}
|
||||
if (params["address"] === null || params["address"] === undefined) {
|
||||
throw new Error("Required parameter \"params['address']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Identity"] = params["identity"];
|
||||
data["BindingType"] = params["bindingType"];
|
||||
data["Address"] = params["address"];
|
||||
if (params["tag"] !== undefined)
|
||||
data["Tag"] = serialize.map(params["tag"], (e) => e);
|
||||
if (params["notificationProtocolVersion"] !== undefined)
|
||||
data["NotificationProtocolVersion"] =
|
||||
params["notificationProtocolVersion"];
|
||||
if (params["credentialSid"] !== undefined)
|
||||
data["CredentialSid"] = params["credentialSid"];
|
||||
if (params["endpoint"] !== undefined)
|
||||
data["Endpoint"] = params["endpoint"];
|
||||
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 BindingInstance(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["identity"] === null || params["identity"] === undefined) {
|
||||
throw new Error("Required parameter \"params['identity']\" missing.");
|
||||
}
|
||||
if (params["bindingType"] === null || params["bindingType"] === undefined) {
|
||||
throw new Error("Required parameter \"params['bindingType']\" missing.");
|
||||
}
|
||||
if (params["address"] === null || params["address"] === undefined) {
|
||||
throw new Error("Required parameter \"params['address']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["Identity"] = params["identity"];
|
||||
data["BindingType"] = params["bindingType"];
|
||||
data["Address"] = params["address"];
|
||||
if (params["tag"] !== undefined)
|
||||
data["Tag"] = serialize.map(params["tag"], (e) => e);
|
||||
if (params["notificationProtocolVersion"] !== undefined)
|
||||
data["NotificationProtocolVersion"] =
|
||||
params["notificationProtocolVersion"];
|
||||
if (params["credentialSid"] !== undefined)
|
||||
data["CredentialSid"] = params["credentialSid"];
|
||||
if (params["endpoint"] !== undefined)
|
||||
data["Endpoint"] = params["endpoint"];
|
||||
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 BindingInstance(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["startDate"] !== undefined)
|
||||
data["StartDate"] = serialize.iso8601Date(params["startDate"]);
|
||||
if (params["endDate"] !== undefined)
|
||||
data["EndDate"] = serialize.iso8601Date(params["endDate"]);
|
||||
if (params["identity"] !== undefined)
|
||||
data["Identity"] = serialize.map(params["identity"], (e) => e);
|
||||
if (params["tag"] !== undefined)
|
||||
data["Tag"] = serialize.map(params["tag"], (e) => e);
|
||||
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 BindingPage(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 BindingPage(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["startDate"] !== undefined)
|
||||
data["StartDate"] = serialize.iso8601Date(params["startDate"]);
|
||||
if (params["endDate"] !== undefined)
|
||||
data["EndDate"] = serialize.iso8601Date(params["endDate"]);
|
||||
if (params["identity"] !== undefined)
|
||||
data["Identity"] = serialize.map(params["identity"], (e) => e);
|
||||
if (params["tag"] !== undefined)
|
||||
data["Tag"] = serialize.map(params["tag"], (e) => e);
|
||||
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 BindingPage(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 BindingPage(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 BindingPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the BindingPage
|
||||
*
|
||||
* @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 BindingInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new BindingInstance(this._version, payload, this._solution.serviceSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.BindingPage = BindingPage;
|
||||
228
node_modules/twilio/lib/rest/notify/v1/service/notification.d.ts
generated
vendored
Normal file
228
node_modules/twilio/lib/rest/notify/v1/service/notification.d.ts
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../../V1";
|
||||
import { ApiResponse } from "../../../../base/ApiResponse";
|
||||
/**
|
||||
* The priority of the notification. Can be: `low` or `high` and the default is `high`. A value of `low` optimizes the client app\'s battery consumption; however, notifications may be delivered with unspecified delay. For FCM and GCM, `low` priority is the same as `Normal` priority. For APNS `low` priority is the same as `5`. A value of `high` sends the notification immediately, and can wake up a sleeping device. For FCM and GCM, `high` is the same as `High` priority. For APNS, `high` is a priority `10`. SMS does not support this property.
|
||||
*/
|
||||
export type NotificationPriority = "high" | "low";
|
||||
/**
|
||||
* Options to pass to create a NotificationInstance
|
||||
*/
|
||||
export interface NotificationListInstanceCreateOptions {
|
||||
/** The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. */
|
||||
body?: string;
|
||||
/** */
|
||||
priority?: NotificationPriority;
|
||||
/** How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. */
|
||||
ttl?: number;
|
||||
/** The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. */
|
||||
title?: string;
|
||||
/** The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. */
|
||||
sound?: string;
|
||||
/** The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. */
|
||||
action?: string;
|
||||
/** The custom key-value pairs of the notification\\\'s payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. */
|
||||
data?: any;
|
||||
/** The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. */
|
||||
apn?: any;
|
||||
/** The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). */
|
||||
gcm?: any;
|
||||
/** The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/quickstart) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. */
|
||||
sms?: any;
|
||||
/** Deprecated. */
|
||||
facebookMessenger?: any;
|
||||
/** The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. */
|
||||
fcm?: any;
|
||||
/** The Segment resource is deprecated. Use the `tag` parameter, instead. */
|
||||
segment?: Array<string>;
|
||||
/** Deprecated. */
|
||||
alexa?: any;
|
||||
/** The destination address specified as a JSON string. Multiple `to_binding` parameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers. */
|
||||
toBinding?: Array<string>;
|
||||
/** URL to send webhooks. */
|
||||
deliveryCallbackUrl?: string;
|
||||
/** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. */
|
||||
identity?: Array<string>;
|
||||
/** A tag that selects the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 5 tags. The implicit tag `all` is available to notify all Bindings in a Service instance. Similarly, the implicit tags `apn`, `fcm`, `gcm`, `sms` and `facebook-messenger` are available to notify all Bindings in a specific channel. */
|
||||
tag?: Array<string>;
|
||||
}
|
||||
export interface NotificationSolution {
|
||||
serviceSid: string;
|
||||
}
|
||||
export interface NotificationListInstance {
|
||||
_version: V1;
|
||||
_solution: NotificationSolution;
|
||||
_uri: string;
|
||||
/**
|
||||
* Create a NotificationInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed NotificationInstance
|
||||
*/
|
||||
create(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>;
|
||||
/**
|
||||
* Create a NotificationInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed NotificationInstance
|
||||
*/
|
||||
create(params: NotificationListInstanceCreateOptions, callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>;
|
||||
/**
|
||||
* Create a NotificationInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed NotificationInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NotificationInstance>) => any): Promise<ApiResponse<NotificationInstance>>;
|
||||
/**
|
||||
* Create a NotificationInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed NotificationInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: NotificationListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<NotificationInstance>) => any): Promise<ApiResponse<NotificationInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function NotificationListInstance(version: V1, serviceSid: string): NotificationListInstance;
|
||||
interface NotificationResource {
|
||||
sid: string;
|
||||
account_sid: string;
|
||||
service_sid: string;
|
||||
date_created: Date;
|
||||
identities: Array<string>;
|
||||
tags: Array<string>;
|
||||
segments: Array<string>;
|
||||
priority: NotificationPriority;
|
||||
ttl: number;
|
||||
title: string;
|
||||
body: string;
|
||||
sound: string;
|
||||
action: string;
|
||||
data: any;
|
||||
apn: any;
|
||||
gcm: any;
|
||||
fcm: any;
|
||||
sms: any;
|
||||
facebook_messenger: any;
|
||||
alexa: any;
|
||||
}
|
||||
export declare class NotificationInstance {
|
||||
protected _version: V1;
|
||||
constructor(_version: V1, payload: NotificationResource, serviceSid: string);
|
||||
/**
|
||||
* The unique string that we created to identify the Notification resource.
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource.
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with.
|
||||
*/
|
||||
serviceSid: string;
|
||||
/**
|
||||
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
*/
|
||||
dateCreated: Date;
|
||||
/**
|
||||
* The list of `identity` values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list.
|
||||
*/
|
||||
identities: Array<string>;
|
||||
/**
|
||||
* The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property.
|
||||
*/
|
||||
tags: Array<string>;
|
||||
/**
|
||||
* The list of Segments to notify. The [Segment](https://www.twilio.com/docs/notify/api/segment-resource) resource is deprecated. Use the `tags` property, instead.
|
||||
*/
|
||||
segments: Array<string>;
|
||||
priority: NotificationPriority;
|
||||
/**
|
||||
* How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property.
|
||||
*/
|
||||
ttl: number;
|
||||
/**
|
||||
* The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices.
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification.
|
||||
*/
|
||||
body: string;
|
||||
/**
|
||||
* The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property.
|
||||
*/
|
||||
sound: string;
|
||||
/**
|
||||
* The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels.
|
||||
*/
|
||||
action: string;
|
||||
/**
|
||||
* The custom key-value pairs of the notification\'s payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels.
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed.
|
||||
*/
|
||||
apn: any;
|
||||
/**
|
||||
* The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed.
|
||||
*/
|
||||
gcm: any;
|
||||
/**
|
||||
* The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel.
|
||||
*/
|
||||
fcm: any;
|
||||
/**
|
||||
* The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array.
|
||||
*/
|
||||
sms: any;
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
facebookMessenger: any;
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
alexa: any;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
accountSid: string;
|
||||
serviceSid: string;
|
||||
dateCreated: Date;
|
||||
identities: string[];
|
||||
tags: string[];
|
||||
segments: string[];
|
||||
priority: NotificationPriority;
|
||||
ttl: number;
|
||||
title: string;
|
||||
body: string;
|
||||
sound: string;
|
||||
action: string;
|
||||
data: any;
|
||||
apn: any;
|
||||
gcm: any;
|
||||
fcm: any;
|
||||
sms: any;
|
||||
facebookMessenger: any;
|
||||
alexa: any;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
217
node_modules/twilio/lib/rest/notify/v1/service/notification.js
generated
vendored
Normal file
217
node_modules/twilio/lib/rest/notify/v1/service/notification.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Twilio - Notify
|
||||
* 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.NotificationInstance = void 0;
|
||||
exports.NotificationListInstance = NotificationListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../../base/deserialize");
|
||||
const serialize = require("../../../../base/serialize");
|
||||
const utility_1 = require("../../../../base/utility");
|
||||
function NotificationListInstance(version, serviceSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
|
||||
throw new Error("Parameter 'serviceSid' is not valid.");
|
||||
}
|
||||
const instance = {};
|
||||
instance._version = version;
|
||||
instance._solution = { serviceSid };
|
||||
instance._uri = `/Services/${serviceSid}/Notifications`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["body"] !== undefined)
|
||||
data["Body"] = params["body"];
|
||||
if (params["priority"] !== undefined)
|
||||
data["Priority"] = params["priority"];
|
||||
if (params["ttl"] !== undefined)
|
||||
data["Ttl"] = params["ttl"];
|
||||
if (params["title"] !== undefined)
|
||||
data["Title"] = params["title"];
|
||||
if (params["sound"] !== undefined)
|
||||
data["Sound"] = params["sound"];
|
||||
if (params["action"] !== undefined)
|
||||
data["Action"] = params["action"];
|
||||
if (params["data"] !== undefined)
|
||||
data["Data"] = serialize.object(params["data"]);
|
||||
if (params["apn"] !== undefined)
|
||||
data["Apn"] = serialize.object(params["apn"]);
|
||||
if (params["gcm"] !== undefined)
|
||||
data["Gcm"] = serialize.object(params["gcm"]);
|
||||
if (params["sms"] !== undefined)
|
||||
data["Sms"] = serialize.object(params["sms"]);
|
||||
if (params["facebookMessenger"] !== undefined)
|
||||
data["FacebookMessenger"] = serialize.object(params["facebookMessenger"]);
|
||||
if (params["fcm"] !== undefined)
|
||||
data["Fcm"] = serialize.object(params["fcm"]);
|
||||
if (params["segment"] !== undefined)
|
||||
data["Segment"] = serialize.map(params["segment"], (e) => e);
|
||||
if (params["alexa"] !== undefined)
|
||||
data["Alexa"] = serialize.object(params["alexa"]);
|
||||
if (params["toBinding"] !== undefined)
|
||||
data["ToBinding"] = serialize.map(params["toBinding"], (e) => e);
|
||||
if (params["deliveryCallbackUrl"] !== undefined)
|
||||
data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"];
|
||||
if (params["identity"] !== undefined)
|
||||
data["Identity"] = serialize.map(params["identity"], (e) => e);
|
||||
if (params["tag"] !== undefined)
|
||||
data["Tag"] = serialize.map(params["tag"], (e) => e);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new NotificationInstance(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["body"] !== undefined)
|
||||
data["Body"] = params["body"];
|
||||
if (params["priority"] !== undefined)
|
||||
data["Priority"] = params["priority"];
|
||||
if (params["ttl"] !== undefined)
|
||||
data["Ttl"] = params["ttl"];
|
||||
if (params["title"] !== undefined)
|
||||
data["Title"] = params["title"];
|
||||
if (params["sound"] !== undefined)
|
||||
data["Sound"] = params["sound"];
|
||||
if (params["action"] !== undefined)
|
||||
data["Action"] = params["action"];
|
||||
if (params["data"] !== undefined)
|
||||
data["Data"] = serialize.object(params["data"]);
|
||||
if (params["apn"] !== undefined)
|
||||
data["Apn"] = serialize.object(params["apn"]);
|
||||
if (params["gcm"] !== undefined)
|
||||
data["Gcm"] = serialize.object(params["gcm"]);
|
||||
if (params["sms"] !== undefined)
|
||||
data["Sms"] = serialize.object(params["sms"]);
|
||||
if (params["facebookMessenger"] !== undefined)
|
||||
data["FacebookMessenger"] = serialize.object(params["facebookMessenger"]);
|
||||
if (params["fcm"] !== undefined)
|
||||
data["Fcm"] = serialize.object(params["fcm"]);
|
||||
if (params["segment"] !== undefined)
|
||||
data["Segment"] = serialize.map(params["segment"], (e) => e);
|
||||
if (params["alexa"] !== undefined)
|
||||
data["Alexa"] = serialize.object(params["alexa"]);
|
||||
if (params["toBinding"] !== undefined)
|
||||
data["ToBinding"] = serialize.map(params["toBinding"], (e) => e);
|
||||
if (params["deliveryCallbackUrl"] !== undefined)
|
||||
data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"];
|
||||
if (params["identity"] !== undefined)
|
||||
data["Identity"] = serialize.map(params["identity"], (e) => e);
|
||||
if (params["tag"] !== undefined)
|
||||
data["Tag"] = serialize.map(params["tag"], (e) => e);
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new NotificationInstance(operationVersion, response.body, instance._solution.serviceSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
class NotificationInstance {
|
||||
constructor(_version, payload, serviceSid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.serviceSid = payload.service_sid;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this.identities = payload.identities;
|
||||
this.tags = payload.tags;
|
||||
this.segments = payload.segments;
|
||||
this.priority = payload.priority;
|
||||
this.ttl = deserialize.integer(payload.ttl);
|
||||
this.title = payload.title;
|
||||
this.body = payload.body;
|
||||
this.sound = payload.sound;
|
||||
this.action = payload.action;
|
||||
this.data = payload.data;
|
||||
this.apn = payload.apn;
|
||||
this.gcm = payload.gcm;
|
||||
this.fcm = payload.fcm;
|
||||
this.sms = payload.sms;
|
||||
this.facebookMessenger = payload.facebook_messenger;
|
||||
this.alexa = payload.alexa;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
accountSid: this.accountSid,
|
||||
serviceSid: this.serviceSid,
|
||||
dateCreated: this.dateCreated,
|
||||
identities: this.identities,
|
||||
tags: this.tags,
|
||||
segments: this.segments,
|
||||
priority: this.priority,
|
||||
ttl: this.ttl,
|
||||
title: this.title,
|
||||
body: this.body,
|
||||
sound: this.sound,
|
||||
action: this.action,
|
||||
data: this.data,
|
||||
apn: this.apn,
|
||||
gcm: this.gcm,
|
||||
fcm: this.fcm,
|
||||
sms: this.sms,
|
||||
facebookMessenger: this.facebookMessenger,
|
||||
alexa: this.alexa,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.NotificationInstance = NotificationInstance;
|
||||
Reference in New Issue
Block a user