Auto-commit 2026-04-29 16:31

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

60
node_modules/twilio/lib/rest/trusthub/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import TrusthubBase from "../TrusthubBase";
import Version from "../../base/Version";
import { ComplianceInquiriesListInstance } from "./v1/complianceInquiries";
import { ComplianceRegistrationInquiriesListInstance } from "./v1/complianceRegistrationInquiries";
import { ComplianceTollfreeInquiriesListInstance } from "./v1/complianceTollfreeInquiries";
import { CustomerProfilesListInstance } from "./v1/customerProfiles";
import { EndUserListInstance } from "./v1/endUser";
import { EndUserTypeListInstance } from "./v1/endUserType";
import { PoliciesListInstance } from "./v1/policies";
import { SupportingDocumentListInstance } from "./v1/supportingDocument";
import { SupportingDocumentTypeListInstance } from "./v1/supportingDocumentType";
import { TrustProductsListInstance } from "./v1/trustProducts";
export default class V1 extends Version {
/**
* Initialize the V1 version of Trusthub
*
* @param domain - The Twilio (Twilio.Trusthub) domain
*/
constructor(domain: TrusthubBase);
/** complianceInquiries - { Twilio.Trusthub.V1.ComplianceInquiriesListInstance } resource */
protected _complianceInquiries?: ComplianceInquiriesListInstance;
/** complianceRegistrationInquiries - { Twilio.Trusthub.V1.ComplianceRegistrationInquiriesListInstance } resource */
protected _complianceRegistrationInquiries?: ComplianceRegistrationInquiriesListInstance;
/** complianceTollfreeInquiries - { Twilio.Trusthub.V1.ComplianceTollfreeInquiriesListInstance } resource */
protected _complianceTollfreeInquiries?: ComplianceTollfreeInquiriesListInstance;
/** customerProfiles - { Twilio.Trusthub.V1.CustomerProfilesListInstance } resource */
protected _customerProfiles?: CustomerProfilesListInstance;
/** endUsers - { Twilio.Trusthub.V1.EndUserListInstance } resource */
protected _endUsers?: EndUserListInstance;
/** endUserTypes - { Twilio.Trusthub.V1.EndUserTypeListInstance } resource */
protected _endUserTypes?: EndUserTypeListInstance;
/** policies - { Twilio.Trusthub.V1.PoliciesListInstance } resource */
protected _policies?: PoliciesListInstance;
/** supportingDocuments - { Twilio.Trusthub.V1.SupportingDocumentListInstance } resource */
protected _supportingDocuments?: SupportingDocumentListInstance;
/** supportingDocumentTypes - { Twilio.Trusthub.V1.SupportingDocumentTypeListInstance } resource */
protected _supportingDocumentTypes?: SupportingDocumentTypeListInstance;
/** trustProducts - { Twilio.Trusthub.V1.TrustProductsListInstance } resource */
protected _trustProducts?: TrustProductsListInstance;
/** Getter for complianceInquiries resource */
get complianceInquiries(): ComplianceInquiriesListInstance;
/** Getter for complianceRegistrationInquiries resource */
get complianceRegistrationInquiries(): ComplianceRegistrationInquiriesListInstance;
/** Getter for complianceTollfreeInquiries resource */
get complianceTollfreeInquiries(): ComplianceTollfreeInquiriesListInstance;
/** Getter for customerProfiles resource */
get customerProfiles(): CustomerProfilesListInstance;
/** Getter for endUsers resource */
get endUsers(): EndUserListInstance;
/** Getter for endUserTypes resource */
get endUserTypes(): EndUserTypeListInstance;
/** Getter for policies resource */
get policies(): PoliciesListInstance;
/** Getter for supportingDocuments resource */
get supportingDocuments(): SupportingDocumentListInstance;
/** Getter for supportingDocumentTypes resource */
get supportingDocumentTypes(): SupportingDocumentTypeListInstance;
/** Getter for trustProducts resource */
get trustProducts(): TrustProductsListInstance;
}

99
node_modules/twilio/lib/rest/trusthub/V1.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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 complianceInquiries_1 = require("./v1/complianceInquiries");
const complianceRegistrationInquiries_1 = require("./v1/complianceRegistrationInquiries");
const complianceTollfreeInquiries_1 = require("./v1/complianceTollfreeInquiries");
const customerProfiles_1 = require("./v1/customerProfiles");
const endUser_1 = require("./v1/endUser");
const endUserType_1 = require("./v1/endUserType");
const policies_1 = require("./v1/policies");
const supportingDocument_1 = require("./v1/supportingDocument");
const supportingDocumentType_1 = require("./v1/supportingDocumentType");
const trustProducts_1 = require("./v1/trustProducts");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Trusthub
*
* @param domain - The Twilio (Twilio.Trusthub) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for complianceInquiries resource */
get complianceInquiries() {
this._complianceInquiries =
this._complianceInquiries || (0, complianceInquiries_1.ComplianceInquiriesListInstance)(this);
return this._complianceInquiries;
}
/** Getter for complianceRegistrationInquiries resource */
get complianceRegistrationInquiries() {
this._complianceRegistrationInquiries =
this._complianceRegistrationInquiries ||
(0, complianceRegistrationInquiries_1.ComplianceRegistrationInquiriesListInstance)(this);
return this._complianceRegistrationInquiries;
}
/** Getter for complianceTollfreeInquiries resource */
get complianceTollfreeInquiries() {
this._complianceTollfreeInquiries =
this._complianceTollfreeInquiries ||
(0, complianceTollfreeInquiries_1.ComplianceTollfreeInquiriesListInstance)(this);
return this._complianceTollfreeInquiries;
}
/** Getter for customerProfiles resource */
get customerProfiles() {
this._customerProfiles =
this._customerProfiles || (0, customerProfiles_1.CustomerProfilesListInstance)(this);
return this._customerProfiles;
}
/** Getter for endUsers resource */
get endUsers() {
this._endUsers = this._endUsers || (0, endUser_1.EndUserListInstance)(this);
return this._endUsers;
}
/** Getter for endUserTypes resource */
get endUserTypes() {
this._endUserTypes = this._endUserTypes || (0, endUserType_1.EndUserTypeListInstance)(this);
return this._endUserTypes;
}
/** Getter for policies resource */
get policies() {
this._policies = this._policies || (0, policies_1.PoliciesListInstance)(this);
return this._policies;
}
/** Getter for supportingDocuments resource */
get supportingDocuments() {
this._supportingDocuments =
this._supportingDocuments || (0, supportingDocument_1.SupportingDocumentListInstance)(this);
return this._supportingDocuments;
}
/** Getter for supportingDocumentTypes resource */
get supportingDocumentTypes() {
this._supportingDocumentTypes =
this._supportingDocumentTypes || (0, supportingDocumentType_1.SupportingDocumentTypeListInstance)(this);
return this._supportingDocumentTypes;
}
/** Getter for trustProducts resource */
get trustProducts() {
this._trustProducts =
this._trustProducts || (0, trustProducts_1.TrustProductsListInstance)(this);
return this._trustProducts;
}
}
exports.default = V1;

View File

@@ -0,0 +1,175 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to update a ComplianceInquiriesInstance
*/
export interface ComplianceInquiriesContextUpdateOptions {
/** The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. */
primaryProfileSid: string;
/** Theme id for styling the inquiry form. */
themeSetId?: string;
}
/**
* Options to pass to create a ComplianceInquiriesInstance
*/
export interface ComplianceInquiriesListInstanceCreateOptions {
/** The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. */
notificationEmail?: string;
/** Theme id for styling the inquiry form. */
themeSetId?: string;
/** The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. */
primaryProfileSid?: string;
}
export interface ComplianceInquiriesContext {
/**
* Update a ComplianceInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance
*/
update(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>;
/**
* Update a ComplianceInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance with HTTP metadata
*/
updateWithHttpInfo(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceInquiriesInstance>) => any): Promise<ApiResponse<ComplianceInquiriesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ComplianceInquiriesContextSolution {
customerId: string;
}
export declare class ComplianceInquiriesContextImpl implements ComplianceInquiriesContext {
protected _version: V1;
protected _solution: ComplianceInquiriesContextSolution;
protected _uri: string;
constructor(_version: V1, customerId: string);
update(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>;
updateWithHttpInfo(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceInquiriesInstance>) => any): Promise<ApiResponse<ComplianceInquiriesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ComplianceInquiriesContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ComplianceInquiriesResource {
inquiry_id: string;
inquiry_session_token: string;
customer_id: string;
url: string;
}
export declare class ComplianceInquiriesInstance {
protected _version: V1;
protected _solution: ComplianceInquiriesContextSolution;
protected _context?: ComplianceInquiriesContext;
constructor(_version: V1, payload: ComplianceInquiriesResource, customerId?: string);
/**
* The unique ID used to start an embedded compliance registration session.
*/
inquiryId: string;
/**
* The session token used to start an embedded compliance registration session.
*/
inquirySessionToken: string;
/**
* The CustomerID matching the Customer Profile that should be resumed or resubmitted for editing.
*/
customerId: string;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Update a ComplianceInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance
*/
update(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>;
/**
* Update a ComplianceInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance with HTTP metadata
*/
updateWithHttpInfo(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceInquiriesInstance>) => any): Promise<ApiResponse<ComplianceInquiriesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
inquiryId: string;
inquirySessionToken: string;
customerId: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ComplianceInquiriesSolution {
}
export interface ComplianceInquiriesListInstance {
_version: V1;
_solution: ComplianceInquiriesSolution;
_uri: string;
(customerId: string): ComplianceInquiriesContext;
get(customerId: string): ComplianceInquiriesContext;
/**
* Create a ComplianceInquiriesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance
*/
create(callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>;
/**
* Create a ComplianceInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance
*/
create(params: ComplianceInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>;
/**
* Create a ComplianceInquiriesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ComplianceInquiriesInstance>) => any): Promise<ApiResponse<ComplianceInquiriesInstance>>;
/**
* Create a ComplianceInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceInquiriesInstance with HTTP metadata
*/
createWithHttpInfo(params: ComplianceInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceInquiriesInstance>) => any): Promise<ApiResponse<ComplianceInquiriesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ComplianceInquiriesListInstance(version: V1): ComplianceInquiriesListInstance;
export {};

View File

@@ -0,0 +1,218 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.ComplianceInquiriesInstance = exports.ComplianceInquiriesContextImpl = void 0;
exports.ComplianceInquiriesListInstance = ComplianceInquiriesListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class ComplianceInquiriesContextImpl {
constructor(_version, customerId) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(customerId)) {
throw new Error("Parameter 'customerId' is not valid.");
}
this._solution = { customerId };
this._uri = `/ComplianceInquiries/Customers/${customerId}/Initialize`;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["primaryProfileSid"] === null ||
params["primaryProfileSid"] === undefined) {
throw new Error("Required parameter \"params['primaryProfileSid']\" missing.");
}
let data = {};
data["PrimaryProfileSid"] = params["primaryProfileSid"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
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 ComplianceInquiriesInstance(operationVersion, payload, instance._solution.customerId));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["primaryProfileSid"] === null ||
params["primaryProfileSid"] === undefined) {
throw new Error("Required parameter \"params['primaryProfileSid']\" missing.");
}
let data = {};
data["PrimaryProfileSid"] = params["primaryProfileSid"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
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 ComplianceInquiriesInstance(operationVersion, response.body, instance._solution.customerId),
}));
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.ComplianceInquiriesContextImpl = ComplianceInquiriesContextImpl;
class ComplianceInquiriesInstance {
constructor(_version, payload, customerId) {
this._version = _version;
this.inquiryId = payload.inquiry_id;
this.inquirySessionToken = payload.inquiry_session_token;
this.customerId = payload.customer_id;
this.url = payload.url;
this._solution = { customerId: customerId || this.customerId };
}
get _proxy() {
this._context =
this._context ||
new ComplianceInquiriesContextImpl(this._version, this._solution.customerId);
return this._context;
}
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 {
inquiryId: this.inquiryId,
inquirySessionToken: this.inquirySessionToken,
customerId: this.customerId,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ComplianceInquiriesInstance = ComplianceInquiriesInstance;
function ComplianceInquiriesListInstance(version) {
const instance = ((customerId) => instance.get(customerId));
instance.get = function get(customerId) {
return new ComplianceInquiriesContextImpl(version, customerId);
};
instance._version = version;
instance._solution = {};
instance._uri = `/ComplianceInquiries/Customers/Initialize`;
instance.create = function create(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["notificationEmail"] !== undefined)
data["NotificationEmail"] = params["notificationEmail"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
if (params["primaryProfileSid"] !== undefined)
data["PrimaryProfileSid"] = params["primaryProfileSid"];
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 ComplianceInquiriesInstance(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["notificationEmail"] !== undefined)
data["NotificationEmail"] = params["notificationEmail"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
if (params["primaryProfileSid"] !== undefined)
data["PrimaryProfileSid"] = params["primaryProfileSid"];
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 ComplianceInquiriesInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,279 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The type of business identity. Can be `direct customer` or `ISV`.
*/
export type ComplianceRegistrationInquiriesBusinessIdentityType = "direct_customer" | "isv_reseller_or_partner" | "unknown";
/**
* The authority that registered the business
*/
export type ComplianceRegistrationInquiriesBusinessRegistrationAuthority = "UK:CRN" | "US:EIN" | "CA:CBN" | "AU:ACN" | "Other";
/**
* The type of End User the regulation requires - can be `Individual` or `Business`.
*/
export type ComplianceRegistrationInquiriesEndUserType = "Individual" | "Business";
/**
* The type of phone number of the Bundle\'s ownership request. Can be `local`, `mobile`, `national`, or `toll-free`.
*/
export type ComplianceRegistrationInquiriesPhoneNumberType = "local" | "national" | "mobile" | "toll-free";
/**
* Options to pass to update a ComplianceRegistrationInquiriesInstance
*/
export interface ComplianceRegistrationInquiriesContextUpdateOptions {
/** Indicates if the inquiry is being started from an ISV embedded component. */
isIsvEmbed?: boolean;
/** Theme id for styling the inquiry form. */
themeSetId?: string;
}
/**
* Options to pass to create a ComplianceRegistrationInquiriesInstance
*/
export interface ComplianceRegistrationInquiriesListInstanceCreateOptions {
/** */
endUserType: ComplianceRegistrationInquiriesEndUserType;
/** */
phoneNumberType: ComplianceRegistrationInquiriesPhoneNumberType;
/** */
businessIdentityType?: ComplianceRegistrationInquiriesBusinessIdentityType;
/** */
businessRegistrationAuthority?: ComplianceRegistrationInquiriesBusinessRegistrationAuthority;
/** he name of the business or organization using the Tollfree number. */
businessLegalName?: string;
/** he email address to receive the notification about the verification result. */
notificationEmail?: string;
/** The email address to receive the notification about the verification result. */
acceptedNotificationReceipt?: boolean;
/** Business registration number of the business */
businessRegistrationNumber?: string;
/** The URL of the business website */
businessWebsiteUrl?: string;
/** Friendly name for your business information */
friendlyName?: string;
/** First name of the authorized representative */
authorizedRepresentative1FirstName?: string;
/** Last name of the authorized representative */
authorizedRepresentative1LastName?: string;
/** Phone number of the authorized representative */
authorizedRepresentative1Phone?: string;
/** Email address of the authorized representative */
authorizedRepresentative1Email?: string;
/** Birthdate of the authorized representative */
authorizedRepresentative1DateOfBirth?: string;
/** Street address of the business */
addressStreet?: string;
/** Street address of the business */
addressStreetSecondary?: string;
/** City of the business */
addressCity?: string;
/** State or province of the business */
addressSubdivision?: string;
/** Postal code of the business */
addressPostalCode?: string;
/** Country code of the business */
addressCountryCode?: string;
/** Street address of the business */
emergencyAddressStreet?: string;
/** Street address of the business */
emergencyAddressStreetSecondary?: string;
/** City of the business */
emergencyAddressCity?: string;
/** State or province of the business */
emergencyAddressSubdivision?: string;
/** Postal code of the business */
emergencyAddressPostalCode?: string;
/** Country code of the business */
emergencyAddressCountryCode?: string;
/** Use the business address as the emergency address */
useAddressAsEmergencyAddress?: boolean;
/** The name of the verification document to upload */
fileName?: string;
/** The verification document to upload */
file?: string;
/** The first name of the Individual User. */
firstName?: string;
/** The last name of the Individual User. */
lastName?: string;
/** The date of birth of the Individual User. */
dateOfBirth?: string;
/** The email address of the Individual User. */
individualEmail?: string;
/** The phone number of the Individual User. */
individualPhone?: string;
/** Indicates if the inquiry is being started from an ISV embedded component. */
isIsvEmbed?: boolean;
/** Indicates if the isv registering for self or tenant. */
isvRegisteringForSelfOrTenant?: string;
/** The url we call to inform you of bundle changes. */
statusCallbackUrl?: string;
/** Theme id for styling the inquiry form. */
themeSetId?: string;
}
export interface ComplianceRegistrationInquiriesContext {
/**
* Update a ComplianceRegistrationInquiriesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance
*/
update(callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>;
/**
* Update a ComplianceRegistrationInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance
*/
update(params: ComplianceRegistrationInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>;
/**
* Update a ComplianceRegistrationInquiriesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any): Promise<ApiResponse<ComplianceRegistrationInquiriesInstance>>;
/**
* Update a ComplianceRegistrationInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance with HTTP metadata
*/
updateWithHttpInfo(params: ComplianceRegistrationInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any): Promise<ApiResponse<ComplianceRegistrationInquiriesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ComplianceRegistrationInquiriesContextSolution {
registrationId: string;
}
export declare class ComplianceRegistrationInquiriesContextImpl implements ComplianceRegistrationInquiriesContext {
protected _version: V1;
protected _solution: ComplianceRegistrationInquiriesContextSolution;
protected _uri: string;
constructor(_version: V1, registrationId: string);
update(params?: ComplianceRegistrationInquiriesContextUpdateOptions | ((error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any), callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>;
updateWithHttpInfo(params?: ComplianceRegistrationInquiriesContextUpdateOptions | ((error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any): Promise<ApiResponse<ComplianceRegistrationInquiriesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ComplianceRegistrationInquiriesContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ComplianceRegistrationInquiriesResource {
inquiry_id: string;
inquiry_session_token: string;
registration_id: string;
url: string;
}
export declare class ComplianceRegistrationInquiriesInstance {
protected _version: V1;
protected _solution: ComplianceRegistrationInquiriesContextSolution;
protected _context?: ComplianceRegistrationInquiriesContext;
constructor(_version: V1, payload: ComplianceRegistrationInquiriesResource, registrationId?: string);
/**
* The unique ID used to start an embedded compliance registration session.
*/
inquiryId: string;
/**
* The session token used to start an embedded compliance registration session.
*/
inquirySessionToken: string;
/**
* The RegistrationId matching the Registration Profile that should be resumed or resubmitted for editing.
*/
registrationId: string;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Update a ComplianceRegistrationInquiriesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance
*/
update(callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>;
/**
* Update a ComplianceRegistrationInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance
*/
update(params: ComplianceRegistrationInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>;
/**
* Update a ComplianceRegistrationInquiriesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any): Promise<ApiResponse<ComplianceRegistrationInquiriesInstance>>;
/**
* Update a ComplianceRegistrationInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance with HTTP metadata
*/
updateWithHttpInfo(params: ComplianceRegistrationInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any): Promise<ApiResponse<ComplianceRegistrationInquiriesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
inquiryId: string;
inquirySessionToken: string;
registrationId: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ComplianceRegistrationInquiriesSolution {
}
export interface ComplianceRegistrationInquiriesListInstance {
_version: V1;
_solution: ComplianceRegistrationInquiriesSolution;
_uri: string;
(registrationId: string): ComplianceRegistrationInquiriesContext;
get(registrationId: string): ComplianceRegistrationInquiriesContext;
/**
* Create a ComplianceRegistrationInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance
*/
create(params: ComplianceRegistrationInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>;
/**
* Create a ComplianceRegistrationInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceRegistrationInquiriesInstance with HTTP metadata
*/
createWithHttpInfo(params: ComplianceRegistrationInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceRegistrationInquiriesInstance>) => any): Promise<ApiResponse<ComplianceRegistrationInquiriesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ComplianceRegistrationInquiriesListInstance(version: V1): ComplianceRegistrationInquiriesListInstance;
export {};

View File

@@ -0,0 +1,386 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.ComplianceRegistrationInquiriesInstance = exports.ComplianceRegistrationInquiriesContextImpl = void 0;
exports.ComplianceRegistrationInquiriesListInstance = ComplianceRegistrationInquiriesListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class ComplianceRegistrationInquiriesContextImpl {
constructor(_version, registrationId) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(registrationId)) {
throw new Error("Parameter 'registrationId' is not valid.");
}
this._solution = { registrationId };
this._uri = `/ComplianceInquiries/Registration/${registrationId}/RegulatoryCompliance/GB/Initialize`;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["isIsvEmbed"] !== undefined)
data["IsIsvEmbed"] = serialize.bool(params["isIsvEmbed"]);
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
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 ComplianceRegistrationInquiriesInstance(operationVersion, payload, instance._solution.registrationId));
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["isIsvEmbed"] !== undefined)
data["IsIsvEmbed"] = serialize.bool(params["isIsvEmbed"]);
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
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 ComplianceRegistrationInquiriesInstance(operationVersion, response.body, instance._solution.registrationId),
}));
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.ComplianceRegistrationInquiriesContextImpl = ComplianceRegistrationInquiriesContextImpl;
class ComplianceRegistrationInquiriesInstance {
constructor(_version, payload, registrationId) {
this._version = _version;
this.inquiryId = payload.inquiry_id;
this.inquirySessionToken = payload.inquiry_session_token;
this.registrationId = payload.registration_id;
this.url = payload.url;
this._solution = { registrationId: registrationId || this.registrationId };
}
get _proxy() {
this._context =
this._context ||
new ComplianceRegistrationInquiriesContextImpl(this._version, this._solution.registrationId);
return this._context;
}
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 {
inquiryId: this.inquiryId,
inquirySessionToken: this.inquirySessionToken,
registrationId: this.registrationId,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ComplianceRegistrationInquiriesInstance = ComplianceRegistrationInquiriesInstance;
function ComplianceRegistrationInquiriesListInstance(version) {
const instance = ((registrationId) => instance.get(registrationId));
instance.get = function get(registrationId) {
return new ComplianceRegistrationInquiriesContextImpl(version, registrationId);
};
instance._version = version;
instance._solution = {};
instance._uri = `/ComplianceInquiries/Registration/RegulatoryCompliance/GB/Initialize`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["endUserType"] === null || params["endUserType"] === undefined) {
throw new Error("Required parameter \"params['endUserType']\" missing.");
}
if (params["phoneNumberType"] === null ||
params["phoneNumberType"] === undefined) {
throw new Error("Required parameter \"params['phoneNumberType']\" missing.");
}
let data = {};
data["EndUserType"] = params["endUserType"];
data["PhoneNumberType"] = params["phoneNumberType"];
if (params["businessIdentityType"] !== undefined)
data["BusinessIdentityType"] = params["businessIdentityType"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessLegalName"] !== undefined)
data["BusinessLegalName"] = params["businessLegalName"];
if (params["notificationEmail"] !== undefined)
data["NotificationEmail"] = params["notificationEmail"];
if (params["acceptedNotificationReceipt"] !== undefined)
data["AcceptedNotificationReceipt"] = serialize.bool(params["acceptedNotificationReceipt"]);
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessWebsiteUrl"] !== undefined)
data["BusinessWebsiteUrl"] = params["businessWebsiteUrl"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["authorizedRepresentative1FirstName"] !== undefined)
data["AuthorizedRepresentative1FirstName"] =
params["authorizedRepresentative1FirstName"];
if (params["authorizedRepresentative1LastName"] !== undefined)
data["AuthorizedRepresentative1LastName"] =
params["authorizedRepresentative1LastName"];
if (params["authorizedRepresentative1Phone"] !== undefined)
data["AuthorizedRepresentative1Phone"] =
params["authorizedRepresentative1Phone"];
if (params["authorizedRepresentative1Email"] !== undefined)
data["AuthorizedRepresentative1Email"] =
params["authorizedRepresentative1Email"];
if (params["authorizedRepresentative1DateOfBirth"] !== undefined)
data["AuthorizedRepresentative1DateOfBirth"] =
params["authorizedRepresentative1DateOfBirth"];
if (params["addressStreet"] !== undefined)
data["AddressStreet"] = params["addressStreet"];
if (params["addressStreetSecondary"] !== undefined)
data["AddressStreetSecondary"] = params["addressStreetSecondary"];
if (params["addressCity"] !== undefined)
data["AddressCity"] = params["addressCity"];
if (params["addressSubdivision"] !== undefined)
data["AddressSubdivision"] = params["addressSubdivision"];
if (params["addressPostalCode"] !== undefined)
data["AddressPostalCode"] = params["addressPostalCode"];
if (params["addressCountryCode"] !== undefined)
data["AddressCountryCode"] = params["addressCountryCode"];
if (params["emergencyAddressStreet"] !== undefined)
data["EmergencyAddressStreet"] = params["emergencyAddressStreet"];
if (params["emergencyAddressStreetSecondary"] !== undefined)
data["EmergencyAddressStreetSecondary"] =
params["emergencyAddressStreetSecondary"];
if (params["emergencyAddressCity"] !== undefined)
data["EmergencyAddressCity"] = params["emergencyAddressCity"];
if (params["emergencyAddressSubdivision"] !== undefined)
data["EmergencyAddressSubdivision"] =
params["emergencyAddressSubdivision"];
if (params["emergencyAddressPostalCode"] !== undefined)
data["EmergencyAddressPostalCode"] = params["emergencyAddressPostalCode"];
if (params["emergencyAddressCountryCode"] !== undefined)
data["EmergencyAddressCountryCode"] =
params["emergencyAddressCountryCode"];
if (params["useAddressAsEmergencyAddress"] !== undefined)
data["UseAddressAsEmergencyAddress"] = serialize.bool(params["useAddressAsEmergencyAddress"]);
if (params["fileName"] !== undefined)
data["FileName"] = params["fileName"];
if (params["file"] !== undefined)
data["File"] = params["file"];
if (params["firstName"] !== undefined)
data["FirstName"] = params["firstName"];
if (params["lastName"] !== undefined)
data["LastName"] = params["lastName"];
if (params["dateOfBirth"] !== undefined)
data["DateOfBirth"] = params["dateOfBirth"];
if (params["individualEmail"] !== undefined)
data["IndividualEmail"] = params["individualEmail"];
if (params["individualPhone"] !== undefined)
data["IndividualPhone"] = params["individualPhone"];
if (params["isIsvEmbed"] !== undefined)
data["IsIsvEmbed"] = serialize.bool(params["isIsvEmbed"]);
if (params["isvRegisteringForSelfOrTenant"] !== undefined)
data["IsvRegisteringForSelfOrTenant"] =
params["isvRegisteringForSelfOrTenant"];
if (params["statusCallbackUrl"] !== undefined)
data["StatusCallbackUrl"] = params["statusCallbackUrl"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
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 ComplianceRegistrationInquiriesInstance(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["endUserType"] === null || params["endUserType"] === undefined) {
throw new Error("Required parameter \"params['endUserType']\" missing.");
}
if (params["phoneNumberType"] === null ||
params["phoneNumberType"] === undefined) {
throw new Error("Required parameter \"params['phoneNumberType']\" missing.");
}
let data = {};
data["EndUserType"] = params["endUserType"];
data["PhoneNumberType"] = params["phoneNumberType"];
if (params["businessIdentityType"] !== undefined)
data["BusinessIdentityType"] = params["businessIdentityType"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessLegalName"] !== undefined)
data["BusinessLegalName"] = params["businessLegalName"];
if (params["notificationEmail"] !== undefined)
data["NotificationEmail"] = params["notificationEmail"];
if (params["acceptedNotificationReceipt"] !== undefined)
data["AcceptedNotificationReceipt"] = serialize.bool(params["acceptedNotificationReceipt"]);
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessWebsiteUrl"] !== undefined)
data["BusinessWebsiteUrl"] = params["businessWebsiteUrl"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["authorizedRepresentative1FirstName"] !== undefined)
data["AuthorizedRepresentative1FirstName"] =
params["authorizedRepresentative1FirstName"];
if (params["authorizedRepresentative1LastName"] !== undefined)
data["AuthorizedRepresentative1LastName"] =
params["authorizedRepresentative1LastName"];
if (params["authorizedRepresentative1Phone"] !== undefined)
data["AuthorizedRepresentative1Phone"] =
params["authorizedRepresentative1Phone"];
if (params["authorizedRepresentative1Email"] !== undefined)
data["AuthorizedRepresentative1Email"] =
params["authorizedRepresentative1Email"];
if (params["authorizedRepresentative1DateOfBirth"] !== undefined)
data["AuthorizedRepresentative1DateOfBirth"] =
params["authorizedRepresentative1DateOfBirth"];
if (params["addressStreet"] !== undefined)
data["AddressStreet"] = params["addressStreet"];
if (params["addressStreetSecondary"] !== undefined)
data["AddressStreetSecondary"] = params["addressStreetSecondary"];
if (params["addressCity"] !== undefined)
data["AddressCity"] = params["addressCity"];
if (params["addressSubdivision"] !== undefined)
data["AddressSubdivision"] = params["addressSubdivision"];
if (params["addressPostalCode"] !== undefined)
data["AddressPostalCode"] = params["addressPostalCode"];
if (params["addressCountryCode"] !== undefined)
data["AddressCountryCode"] = params["addressCountryCode"];
if (params["emergencyAddressStreet"] !== undefined)
data["EmergencyAddressStreet"] = params["emergencyAddressStreet"];
if (params["emergencyAddressStreetSecondary"] !== undefined)
data["EmergencyAddressStreetSecondary"] =
params["emergencyAddressStreetSecondary"];
if (params["emergencyAddressCity"] !== undefined)
data["EmergencyAddressCity"] = params["emergencyAddressCity"];
if (params["emergencyAddressSubdivision"] !== undefined)
data["EmergencyAddressSubdivision"] =
params["emergencyAddressSubdivision"];
if (params["emergencyAddressPostalCode"] !== undefined)
data["EmergencyAddressPostalCode"] = params["emergencyAddressPostalCode"];
if (params["emergencyAddressCountryCode"] !== undefined)
data["EmergencyAddressCountryCode"] =
params["emergencyAddressCountryCode"];
if (params["useAddressAsEmergencyAddress"] !== undefined)
data["UseAddressAsEmergencyAddress"] = serialize.bool(params["useAddressAsEmergencyAddress"]);
if (params["fileName"] !== undefined)
data["FileName"] = params["fileName"];
if (params["file"] !== undefined)
data["File"] = params["file"];
if (params["firstName"] !== undefined)
data["FirstName"] = params["firstName"];
if (params["lastName"] !== undefined)
data["LastName"] = params["lastName"];
if (params["dateOfBirth"] !== undefined)
data["DateOfBirth"] = params["dateOfBirth"];
if (params["individualEmail"] !== undefined)
data["IndividualEmail"] = params["individualEmail"];
if (params["individualPhone"] !== undefined)
data["IndividualPhone"] = params["individualPhone"];
if (params["isIsvEmbed"] !== undefined)
data["IsIsvEmbed"] = serialize.bool(params["isIsvEmbed"]);
if (params["isvRegisteringForSelfOrTenant"] !== undefined)
data["IsvRegisteringForSelfOrTenant"] =
params["isvRegisteringForSelfOrTenant"];
if (params["statusCallbackUrl"] !== undefined)
data["StatusCallbackUrl"] = params["statusCallbackUrl"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
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 ComplianceRegistrationInquiriesInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,162 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Type of Business.
*/
export type ComplianceTollfreeInquiriesBusinessType = "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "SOLE_PROPRIETOR" | "GOVERNMENT";
/**
* Describe how a user opts-in to text messages.
*/
export type ComplianceTollfreeInquiriesOptInType = "VERBAL" | "WEB_FORM" | "PAPER_FORM" | "VIA_TEXT" | "MOBILE_QR_CODE";
/**
* Options to pass to create a ComplianceTollfreeInquiriesInstance
*/
export interface ComplianceTollfreeInquiriesListInstanceCreateOptions {
/** The Tollfree phone number to be verified */
tollfreePhoneNumber: string;
/** The email address to receive the notification about the verification result. */
notificationEmail: string;
/** The Customer Profile Sid associated with the Account. */
customerProfileSid?: string;
/** The name of the business or organization using the Tollfree number. */
businessName?: string;
/** The website of the business or organization using the Tollfree number. */
businessWebsite?: string;
/** The category of the use case for the Tollfree Number. List as many are applicable.. */
useCaseCategories?: Array<string>;
/** Use this to further explain how messaging is used by the business or organization. */
useCaseSummary?: string;
/** An example of message content, i.e. a sample message. */
productionMessageSample?: string;
/** Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */
optInImageUrls?: Array<string>;
/** */
optInType?: ComplianceTollfreeInquiriesOptInType;
/** Estimate monthly volume of messages from the Tollfree Number. */
messageVolume?: string;
/** The address of the business or organization using the Tollfree number. */
businessStreetAddress?: string;
/** The address of the business or organization using the Tollfree number. */
businessStreetAddress2?: string;
/** The city of the business or organization using the Tollfree number. */
businessCity?: string;
/** The state/province/region of the business or organization using the Tollfree number. */
businessStateProvinceRegion?: string;
/** The postal code of the business or organization using the Tollfree number. */
businessPostalCode?: string;
/** The country of the business or organization using the Tollfree number. */
businessCountry?: string;
/** Additional information to be provided for verification. */
additionalInformation?: string;
/** The first name of the contact for the business or organization using the Tollfree number. */
businessContactFirstName?: string;
/** The last name of the contact for the business or organization using the Tollfree number. */
businessContactLastName?: string;
/** The email address of the contact for the business or organization using the Tollfree number. */
businessContactEmail?: string;
/** The phone number of the contact for the business or organization using the Tollfree number. */
businessContactPhone?: string;
/** Theme id for styling the inquiry form. */
themeSetId?: string;
/** Skip the messaging use case screen of the inquiry form. */
skipMessagingUseCase?: boolean;
/** The Business Registration Number of the business or organization. */
businessRegistrationNumber?: string;
/** The Business Registration Authority of the business or organization. */
businessRegistrationAuthority?: string;
/** The Business Registration Country of the business or organization. */
businessRegistrationCountry?: string;
/** */
businessType?: ComplianceTollfreeInquiriesBusinessType;
/** Trade name, sub entity, or downstream business name of business being submitted for verification. */
doingBusinessAs?: string;
/** The confirmation message sent to users when they opt in to receive messages. */
optInConfirmationMessage?: string;
/** A sample help message provided to users. */
helpMessageSample?: string;
/** The URL to the privacy policy for the business or organization. */
privacyPolicyUrl?: string;
/** The URL to the terms and conditions for the business or organization. */
termsAndConditionsUrl?: string;
/** Indicates if the content is age gated. */
ageGatedContent?: boolean;
/** A legally recognized business registration number. */
externalReferenceId?: string;
/** List of keywords that users can text in to opt in to receive messages. */
optInKeywords?: Array<string>;
/** Unique identifier for the created Vetting . */
vettingId?: string;
/** Name of the vetting provider. */
vettingProvider?: string;
}
export interface ComplianceTollfreeInquiriesSolution {
}
export interface ComplianceTollfreeInquiriesListInstance {
_version: V1;
_solution: ComplianceTollfreeInquiriesSolution;
_uri: string;
/**
* Create a ComplianceTollfreeInquiriesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceTollfreeInquiriesInstance
*/
create(params: ComplianceTollfreeInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ComplianceTollfreeInquiriesInstance) => any): Promise<ComplianceTollfreeInquiriesInstance>;
/**
* Create a ComplianceTollfreeInquiriesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ComplianceTollfreeInquiriesInstance with HTTP metadata
*/
createWithHttpInfo(params: ComplianceTollfreeInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ComplianceTollfreeInquiriesInstance>) => any): Promise<ApiResponse<ComplianceTollfreeInquiriesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ComplianceTollfreeInquiriesListInstance(version: V1): ComplianceTollfreeInquiriesListInstance;
interface ComplianceTollfreeInquiriesResource {
inquiry_id: string;
inquiry_session_token: string;
registration_id: string;
url: string;
}
export declare class ComplianceTollfreeInquiriesInstance {
protected _version: V1;
constructor(_version: V1, payload: ComplianceTollfreeInquiriesResource);
/**
* The unique ID used to start an embedded compliance registration session.
*/
inquiryId: string;
/**
* The session token used to start an embedded compliance registration session.
*/
inquirySessionToken: string;
/**
* The TolfreeId matching the Tollfree Profile that should be resumed or resubmitted for editing.
*/
registrationId: string;
/**
* The URL of this resource.
*/
url: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
inquiryId: string;
inquirySessionToken: string;
registrationId: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,271 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.ComplianceTollfreeInquiriesInstance = void 0;
exports.ComplianceTollfreeInquiriesListInstance = ComplianceTollfreeInquiriesListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function ComplianceTollfreeInquiriesListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/ComplianceInquiries/Tollfree/Initialize`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["tollfreePhoneNumber"] === null ||
params["tollfreePhoneNumber"] === undefined) {
throw new Error("Required parameter \"params['tollfreePhoneNumber']\" missing.");
}
if (params["notificationEmail"] === null ||
params["notificationEmail"] === undefined) {
throw new Error("Required parameter \"params['notificationEmail']\" missing.");
}
let data = {};
data["TollfreePhoneNumber"] = params["tollfreePhoneNumber"];
data["NotificationEmail"] = params["notificationEmail"];
if (params["customerProfileSid"] !== undefined)
data["CustomerProfileSid"] = params["customerProfileSid"];
if (params["businessName"] !== undefined)
data["BusinessName"] = params["businessName"];
if (params["businessWebsite"] !== undefined)
data["BusinessWebsite"] = params["businessWebsite"];
if (params["useCaseCategories"] !== undefined)
data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e);
if (params["useCaseSummary"] !== undefined)
data["UseCaseSummary"] = params["useCaseSummary"];
if (params["productionMessageSample"] !== undefined)
data["ProductionMessageSample"] = params["productionMessageSample"];
if (params["optInImageUrls"] !== undefined)
data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e);
if (params["optInType"] !== undefined)
data["OptInType"] = params["optInType"];
if (params["messageVolume"] !== undefined)
data["MessageVolume"] = params["messageVolume"];
if (params["businessStreetAddress"] !== undefined)
data["BusinessStreetAddress"] = params["businessStreetAddress"];
if (params["businessStreetAddress2"] !== undefined)
data["BusinessStreetAddress2"] = params["businessStreetAddress2"];
if (params["businessCity"] !== undefined)
data["BusinessCity"] = params["businessCity"];
if (params["businessStateProvinceRegion"] !== undefined)
data["BusinessStateProvinceRegion"] =
params["businessStateProvinceRegion"];
if (params["businessPostalCode"] !== undefined)
data["BusinessPostalCode"] = params["businessPostalCode"];
if (params["businessCountry"] !== undefined)
data["BusinessCountry"] = params["businessCountry"];
if (params["additionalInformation"] !== undefined)
data["AdditionalInformation"] = params["additionalInformation"];
if (params["businessContactFirstName"] !== undefined)
data["BusinessContactFirstName"] = params["businessContactFirstName"];
if (params["businessContactLastName"] !== undefined)
data["BusinessContactLastName"] = params["businessContactLastName"];
if (params["businessContactEmail"] !== undefined)
data["BusinessContactEmail"] = params["businessContactEmail"];
if (params["businessContactPhone"] !== undefined)
data["BusinessContactPhone"] = params["businessContactPhone"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
if (params["skipMessagingUseCase"] !== undefined)
data["SkipMessagingUseCase"] = serialize.bool(params["skipMessagingUseCase"]);
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessRegistrationCountry"] !== undefined)
data["BusinessRegistrationCountry"] =
params["businessRegistrationCountry"];
if (params["businessType"] !== undefined)
data["BusinessType"] = params["businessType"];
if (params["doingBusinessAs"] !== undefined)
data["DoingBusinessAs"] = params["doingBusinessAs"];
if (params["optInConfirmationMessage"] !== undefined)
data["OptInConfirmationMessage"] = params["optInConfirmationMessage"];
if (params["helpMessageSample"] !== undefined)
data["HelpMessageSample"] = params["helpMessageSample"];
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
if (params["ageGatedContent"] !== undefined)
data["AgeGatedContent"] = serialize.bool(params["ageGatedContent"]);
if (params["externalReferenceId"] !== undefined)
data["ExternalReferenceId"] = params["externalReferenceId"];
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
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 ComplianceTollfreeInquiriesInstance(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["tollfreePhoneNumber"] === null ||
params["tollfreePhoneNumber"] === undefined) {
throw new Error("Required parameter \"params['tollfreePhoneNumber']\" missing.");
}
if (params["notificationEmail"] === null ||
params["notificationEmail"] === undefined) {
throw new Error("Required parameter \"params['notificationEmail']\" missing.");
}
let data = {};
data["TollfreePhoneNumber"] = params["tollfreePhoneNumber"];
data["NotificationEmail"] = params["notificationEmail"];
if (params["customerProfileSid"] !== undefined)
data["CustomerProfileSid"] = params["customerProfileSid"];
if (params["businessName"] !== undefined)
data["BusinessName"] = params["businessName"];
if (params["businessWebsite"] !== undefined)
data["BusinessWebsite"] = params["businessWebsite"];
if (params["useCaseCategories"] !== undefined)
data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e);
if (params["useCaseSummary"] !== undefined)
data["UseCaseSummary"] = params["useCaseSummary"];
if (params["productionMessageSample"] !== undefined)
data["ProductionMessageSample"] = params["productionMessageSample"];
if (params["optInImageUrls"] !== undefined)
data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e);
if (params["optInType"] !== undefined)
data["OptInType"] = params["optInType"];
if (params["messageVolume"] !== undefined)
data["MessageVolume"] = params["messageVolume"];
if (params["businessStreetAddress"] !== undefined)
data["BusinessStreetAddress"] = params["businessStreetAddress"];
if (params["businessStreetAddress2"] !== undefined)
data["BusinessStreetAddress2"] = params["businessStreetAddress2"];
if (params["businessCity"] !== undefined)
data["BusinessCity"] = params["businessCity"];
if (params["businessStateProvinceRegion"] !== undefined)
data["BusinessStateProvinceRegion"] =
params["businessStateProvinceRegion"];
if (params["businessPostalCode"] !== undefined)
data["BusinessPostalCode"] = params["businessPostalCode"];
if (params["businessCountry"] !== undefined)
data["BusinessCountry"] = params["businessCountry"];
if (params["additionalInformation"] !== undefined)
data["AdditionalInformation"] = params["additionalInformation"];
if (params["businessContactFirstName"] !== undefined)
data["BusinessContactFirstName"] = params["businessContactFirstName"];
if (params["businessContactLastName"] !== undefined)
data["BusinessContactLastName"] = params["businessContactLastName"];
if (params["businessContactEmail"] !== undefined)
data["BusinessContactEmail"] = params["businessContactEmail"];
if (params["businessContactPhone"] !== undefined)
data["BusinessContactPhone"] = params["businessContactPhone"];
if (params["themeSetId"] !== undefined)
data["ThemeSetId"] = params["themeSetId"];
if (params["skipMessagingUseCase"] !== undefined)
data["SkipMessagingUseCase"] = serialize.bool(params["skipMessagingUseCase"]);
if (params["businessRegistrationNumber"] !== undefined)
data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"];
if (params["businessRegistrationAuthority"] !== undefined)
data["BusinessRegistrationAuthority"] =
params["businessRegistrationAuthority"];
if (params["businessRegistrationCountry"] !== undefined)
data["BusinessRegistrationCountry"] =
params["businessRegistrationCountry"];
if (params["businessType"] !== undefined)
data["BusinessType"] = params["businessType"];
if (params["doingBusinessAs"] !== undefined)
data["DoingBusinessAs"] = params["doingBusinessAs"];
if (params["optInConfirmationMessage"] !== undefined)
data["OptInConfirmationMessage"] = params["optInConfirmationMessage"];
if (params["helpMessageSample"] !== undefined)
data["HelpMessageSample"] = params["helpMessageSample"];
if (params["privacyPolicyUrl"] !== undefined)
data["PrivacyPolicyUrl"] = params["privacyPolicyUrl"];
if (params["termsAndConditionsUrl"] !== undefined)
data["TermsAndConditionsUrl"] = params["termsAndConditionsUrl"];
if (params["ageGatedContent"] !== undefined)
data["AgeGatedContent"] = serialize.bool(params["ageGatedContent"]);
if (params["externalReferenceId"] !== undefined)
data["ExternalReferenceId"] = params["externalReferenceId"];
if (params["optInKeywords"] !== undefined)
data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e);
if (params["vettingId"] !== undefined)
data["VettingId"] = params["vettingId"];
if (params["vettingProvider"] !== undefined)
data["VettingProvider"] = params["vettingProvider"];
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 ComplianceTollfreeInquiriesInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ComplianceTollfreeInquiriesInstance {
constructor(_version, payload) {
this._version = _version;
this.inquiryId = payload.inquiry_id;
this.inquirySessionToken = payload.inquiry_session_token;
this.registrationId = payload.registration_id;
this.url = payload.url;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
inquiryId: this.inquiryId,
inquirySessionToken: this.inquirySessionToken,
registrationId: this.registrationId,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ComplianceTollfreeInquiriesInstance = ComplianceTollfreeInquiriesInstance;

View File

@@ -0,0 +1,519 @@
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 { CustomerProfilesChannelEndpointAssignmentListInstance } from "./customerProfiles/customerProfilesChannelEndpointAssignment";
import { CustomerProfilesEntityAssignmentsListInstance } from "./customerProfiles/customerProfilesEntityAssignments";
import { CustomerProfilesEvaluationsListInstance } from "./customerProfiles/customerProfilesEvaluations";
/**
* The verification status of the Customer-Profile resource.
*/
export type CustomerProfilesStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved";
/**
* Options to pass to update a CustomerProfilesInstance
*/
export interface CustomerProfilesContextUpdateOptions {
/** */
status?: CustomerProfilesStatus;
/** The URL we call to inform your application of status changes. */
statusCallback?: string;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The email address that will receive updates when the Customer-Profile resource changes status. */
email?: string;
}
/**
* Options to pass to create a CustomerProfilesInstance
*/
export interface CustomerProfilesListInstanceCreateOptions {
/** The string that you assigned to describe the resource. */
friendlyName: string;
/** The email address that will receive updates when the Customer-Profile resource changes status. */
email: string;
/** The unique string of a policy that is associated to the Customer-Profile resource. */
policySid: string;
/** The URL we call to inform your application of status changes. */
statusCallback?: string;
}
/**
* Options to pass to each
*/
export interface CustomerProfilesListInstanceEachOptions {
/** The verification status of the Customer-Profile resource. */
status?: CustomerProfilesStatus;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The unique string of a policy that is associated to the Customer-Profile resource. */
policySid?: 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: CustomerProfilesInstance, 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 CustomerProfilesListInstanceOptions {
/** The verification status of the Customer-Profile resource. */
status?: CustomerProfilesStatus;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The unique string of a policy that is associated to the Customer-Profile resource. */
policySid?: 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 CustomerProfilesListInstancePageOptions {
/** The verification status of the Customer-Profile resource. */
status?: CustomerProfilesStatus;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The unique string of a policy that is associated to the Customer-Profile resource. */
policySid?: 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 CustomerProfilesContext {
customerProfilesChannelEndpointAssignment: CustomerProfilesChannelEndpointAssignmentListInstance;
customerProfilesEntityAssignments: CustomerProfilesEntityAssignmentsListInstance;
customerProfilesEvaluations: CustomerProfilesEvaluationsListInstance;
/**
* Remove a CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomerProfilesInstance 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 CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Fetch a CustomerProfilesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Update a CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
update(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Update a CustomerProfilesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
update(params: CustomerProfilesContextUpdateOptions, callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Update a CustomerProfilesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Update a CustomerProfilesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
updateWithHttpInfo(params: CustomerProfilesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CustomerProfilesContextSolution {
sid: string;
}
export declare class CustomerProfilesContextImpl implements CustomerProfilesContext {
protected _version: V1;
protected _solution: CustomerProfilesContextSolution;
protected _uri: string;
protected _customerProfilesChannelEndpointAssignment?: CustomerProfilesChannelEndpointAssignmentListInstance;
protected _customerProfilesEntityAssignments?: CustomerProfilesEntityAssignmentsListInstance;
protected _customerProfilesEvaluations?: CustomerProfilesEvaluationsListInstance;
constructor(_version: V1, sid: string);
get customerProfilesChannelEndpointAssignment(): CustomerProfilesChannelEndpointAssignmentListInstance;
get customerProfilesEntityAssignments(): CustomerProfilesEntityAssignmentsListInstance;
get customerProfilesEvaluations(): CustomerProfilesEvaluationsListInstance;
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?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
update(params?: CustomerProfilesContextUpdateOptions | ((error: Error | null, item?: CustomerProfilesInstance) => any), callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
updateWithHttpInfo(params?: CustomerProfilesContextUpdateOptions | ((error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CustomerProfilesContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CustomerProfilesPayload extends TwilioResponsePayload {
results: CustomerProfilesResource[];
}
interface CustomerProfilesResource {
sid: string;
account_sid: string;
policy_sid: string;
friendly_name: string;
status: CustomerProfilesStatus;
valid_until: Date;
email: string;
status_callback: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
errors: Array<any>;
}
export declare class CustomerProfilesInstance {
protected _version: V1;
protected _solution: CustomerProfilesContextSolution;
protected _context?: CustomerProfilesContext;
constructor(_version: V1, payload: CustomerProfilesResource, sid?: string);
/**
* The unique string that we created to identify the Customer-Profile resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource.
*/
accountSid: string;
/**
* The unique string of a policy that is associated to the Customer-Profile resource.
*/
policySid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
status: CustomerProfilesStatus;
/**
* The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until.
*/
validUntil: Date;
/**
* The email address that will receive updates when the Customer-Profile resource changes status.
*/
email: string;
/**
* The URL we call to inform your application of status changes.
*/
statusCallback: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the Customer-Profile resource.
*/
url: string;
/**
* The URLs of the Assigned Items of the Customer-Profile resource.
*/
links: Record<string, string>;
/**
* The error codes associated with the rejection of the Customer-Profile.
*/
errors: Array<any>;
private get _proxy();
/**
* Remove a CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomerProfilesInstance 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 CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Fetch a CustomerProfilesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Update a CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
update(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Update a CustomerProfilesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
update(params: CustomerProfilesContextUpdateOptions, callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Update a CustomerProfilesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Update a CustomerProfilesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
updateWithHttpInfo(params: CustomerProfilesContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Access the customerProfilesChannelEndpointAssignment.
*/
customerProfilesChannelEndpointAssignment(): CustomerProfilesChannelEndpointAssignmentListInstance;
/**
* Access the customerProfilesEntityAssignments.
*/
customerProfilesEntityAssignments(): CustomerProfilesEntityAssignmentsListInstance;
/**
* Access the customerProfilesEvaluations.
*/
customerProfilesEvaluations(): CustomerProfilesEvaluationsListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
policySid: string;
friendlyName: string;
status: CustomerProfilesStatus;
validUntil: Date;
email: string;
statusCallback: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
errors: any[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CustomerProfilesSolution {
}
export interface CustomerProfilesListInstance {
_version: V1;
_solution: CustomerProfilesSolution;
_uri: string;
(sid: string): CustomerProfilesContext;
get(sid: string): CustomerProfilesContext;
/**
* Create a CustomerProfilesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
create(params: CustomerProfilesListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>;
/**
* Create a CustomerProfilesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance with HTTP metadata
*/
createWithHttpInfo(params: CustomerProfilesListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesInstance>) => any): Promise<ApiResponse<CustomerProfilesInstance>>;
/**
* Streams CustomerProfilesInstance 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 { CustomerProfilesListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CustomerProfilesInstance, done: (err?: Error) => void) => void): void;
each(params: CustomerProfilesListInstanceEachOptions, callback?: (item: CustomerProfilesInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CustomerProfilesInstance 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 { CustomerProfilesListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CustomerProfilesInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CustomerProfilesListInstanceEachOptions, callback?: (item: CustomerProfilesInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CustomerProfilesInstance 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: CustomerProfilesPage) => any): Promise<CustomerProfilesPage>;
/**
* Retrieve a single target page of CustomerProfilesInstance 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<CustomerProfilesPage>) => any): Promise<ApiResponse<CustomerProfilesPage>>;
/**
* Lists CustomerProfilesInstance 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 { CustomerProfilesListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CustomerProfilesInstance[]) => any): Promise<CustomerProfilesInstance[]>;
list(params: CustomerProfilesListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesInstance[]) => any): Promise<CustomerProfilesInstance[]>;
/**
* Lists CustomerProfilesInstance 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 { CustomerProfilesListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesInstance[]>) => any): Promise<ApiResponse<CustomerProfilesInstance[]>>;
listWithHttpInfo(params: CustomerProfilesListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesInstance[]>) => any): Promise<ApiResponse<CustomerProfilesInstance[]>>;
/**
* Retrieve a single page of CustomerProfilesInstance 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 { CustomerProfilesListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CustomerProfilesPage) => any): Promise<CustomerProfilesPage>;
page(params: CustomerProfilesListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesPage) => any): Promise<CustomerProfilesPage>;
/**
* Retrieve a single page of CustomerProfilesInstance 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 { CustomerProfilesListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesPage>) => any): Promise<ApiResponse<CustomerProfilesPage>>;
pageWithHttpInfo(params: CustomerProfilesListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesPage>) => any): Promise<ApiResponse<CustomerProfilesPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CustomerProfilesListInstance(version: V1): CustomerProfilesListInstance;
export declare class CustomerProfilesPage extends Page<V1, CustomerProfilesPayload, CustomerProfilesResource, CustomerProfilesInstance> {
/**
* Initialize the CustomerProfilesPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CustomerProfilesSolution);
/**
* Build an instance of CustomerProfilesInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CustomerProfilesResource): CustomerProfilesInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,518 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.CustomerProfilesPage = exports.CustomerProfilesInstance = exports.CustomerProfilesContextImpl = void 0;
exports.CustomerProfilesListInstance = CustomerProfilesListInstance;
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 customerProfilesChannelEndpointAssignment_1 = require("./customerProfiles/customerProfilesChannelEndpointAssignment");
const customerProfilesEntityAssignments_1 = require("./customerProfiles/customerProfilesEntityAssignments");
const customerProfilesEvaluations_1 = require("./customerProfiles/customerProfilesEvaluations");
class CustomerProfilesContextImpl {
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 = `/CustomerProfiles/${sid}`;
}
get customerProfilesChannelEndpointAssignment() {
this._customerProfilesChannelEndpointAssignment =
this._customerProfilesChannelEndpointAssignment ||
(0, customerProfilesChannelEndpointAssignment_1.CustomerProfilesChannelEndpointAssignmentListInstance)(this._version, this._solution.sid);
return this._customerProfilesChannelEndpointAssignment;
}
get customerProfilesEntityAssignments() {
this._customerProfilesEntityAssignments =
this._customerProfilesEntityAssignments ||
(0, customerProfilesEntityAssignments_1.CustomerProfilesEntityAssignmentsListInstance)(this._version, this._solution.sid);
return this._customerProfilesEntityAssignments;
}
get customerProfilesEvaluations() {
this._customerProfilesEvaluations =
this._customerProfilesEvaluations ||
(0, customerProfilesEvaluations_1.CustomerProfilesEvaluationsListInstance)(this._version, this._solution.sid);
return this._customerProfilesEvaluations;
}
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 CustomerProfilesInstance(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 CustomerProfilesInstance(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
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 CustomerProfilesInstance(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
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 CustomerProfilesInstance(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.CustomerProfilesContextImpl = CustomerProfilesContextImpl;
class CustomerProfilesInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.policySid = payload.policy_sid;
this.friendlyName = payload.friendly_name;
this.status = payload.status;
this.validUntil = deserialize.iso8601DateTime(payload.valid_until);
this.email = payload.email;
this.statusCallback = payload.status_callback;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this.errors = payload.errors;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CustomerProfilesContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a CustomerProfilesInstance 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 CustomerProfilesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CustomerProfilesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesInstance 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 customerProfilesChannelEndpointAssignment.
*/
customerProfilesChannelEndpointAssignment() {
return this._proxy.customerProfilesChannelEndpointAssignment;
}
/**
* Access the customerProfilesEntityAssignments.
*/
customerProfilesEntityAssignments() {
return this._proxy.customerProfilesEntityAssignments;
}
/**
* Access the customerProfilesEvaluations.
*/
customerProfilesEvaluations() {
return this._proxy.customerProfilesEvaluations;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
policySid: this.policySid,
friendlyName: this.friendlyName,
status: this.status,
validUntil: this.validUntil,
email: this.email,
statusCallback: this.statusCallback,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
errors: this.errors,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesInstance = CustomerProfilesInstance;
function CustomerProfilesListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CustomerProfilesContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/CustomerProfiles`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["email"] === null || params["email"] === undefined) {
throw new Error("Required parameter \"params['email']\" missing.");
}
if (params["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Email"] = params["email"];
data["PolicySid"] = params["policySid"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
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 CustomerProfilesInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["email"] === null || params["email"] === undefined) {
throw new Error("Required parameter \"params['email']\" missing.");
}
if (params["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Email"] = params["email"];
data["PolicySid"] = params["policySid"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
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 CustomerProfilesInstance(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["policySid"] !== undefined)
data["PolicySid"] = params["policySid"];
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 CustomerProfilesPage(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 CustomerProfilesPage(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["policySid"] !== undefined)
data["PolicySid"] = params["policySid"];
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 CustomerProfilesPage(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 CustomerProfilesPage(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 CustomerProfilesPage extends Page_1.default {
/**
* Initialize the CustomerProfilesPage
*
* @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 CustomerProfilesInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CustomerProfilesInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesPage = CustomerProfilesPage;

View File

@@ -0,0 +1,367 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a CustomerProfilesChannelEndpointAssignmentInstance
*/
export interface CustomerProfilesChannelEndpointAssignmentListInstanceCreateOptions {
/** The type of channel endpoint. eg: phone-number */
channelEndpointType: string;
/** The SID of an channel endpoint */
channelEndpointSid: string;
}
/**
* Options to pass to each
*/
export interface CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions {
/** The SID of an channel endpoint */
channelEndpointSid?: string;
/** comma separated list of channel endpoint sids */
channelEndpointSids?: 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: CustomerProfilesChannelEndpointAssignmentInstance, 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 CustomerProfilesChannelEndpointAssignmentListInstanceOptions {
/** The SID of an channel endpoint */
channelEndpointSid?: string;
/** comma separated list of channel endpoint sids */
channelEndpointSids?: 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 CustomerProfilesChannelEndpointAssignmentListInstancePageOptions {
/** The SID of an channel endpoint */
channelEndpointSid?: string;
/** comma separated list of channel endpoint sids */
channelEndpointSids?: 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 CustomerProfilesChannelEndpointAssignmentContext {
/**
* Remove a CustomerProfilesChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomerProfilesChannelEndpointAssignmentInstance 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 CustomerProfilesChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>;
/**
* Fetch a CustomerProfilesChannelEndpointAssignmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CustomerProfilesChannelEndpointAssignmentContextSolution {
customerProfileSid: string;
sid: string;
}
export declare class CustomerProfilesChannelEndpointAssignmentContextImpl implements CustomerProfilesChannelEndpointAssignmentContext {
protected _version: V1;
protected _solution: CustomerProfilesChannelEndpointAssignmentContextSolution;
protected _uri: string;
constructor(_version: V1, customerProfileSid: 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?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CustomerProfilesChannelEndpointAssignmentContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CustomerProfilesChannelEndpointAssignmentPayload extends TwilioResponsePayload {
results: CustomerProfilesChannelEndpointAssignmentResource[];
}
interface CustomerProfilesChannelEndpointAssignmentResource {
sid: string;
customer_profile_sid: string;
account_sid: string;
channel_endpoint_type: string;
channel_endpoint_sid: string;
date_created: Date;
url: string;
}
export declare class CustomerProfilesChannelEndpointAssignmentInstance {
protected _version: V1;
protected _solution: CustomerProfilesChannelEndpointAssignmentContextSolution;
protected _context?: CustomerProfilesChannelEndpointAssignmentContext;
constructor(_version: V1, payload: CustomerProfilesChannelEndpointAssignmentResource, customerProfileSid: string, sid?: string);
/**
* The unique string that we created to identify the Item Assignment resource.
*/
sid: string;
/**
* The unique string that we created to identify the CustomerProfile resource.
*/
customerProfileSid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
*/
accountSid: string;
/**
* The type of channel endpoint. eg: phone-number
*/
channelEndpointType: string;
/**
* The SID of an channel endpoint
*/
channelEndpointSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The absolute URL of the Identity resource.
*/
url: string;
private get _proxy();
/**
* Remove a CustomerProfilesChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomerProfilesChannelEndpointAssignmentInstance 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 CustomerProfilesChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>;
/**
* Fetch a CustomerProfilesChannelEndpointAssignmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
customerProfileSid: string;
accountSid: string;
channelEndpointType: string;
channelEndpointSid: string;
dateCreated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CustomerProfilesChannelEndpointAssignmentSolution {
customerProfileSid: string;
}
export interface CustomerProfilesChannelEndpointAssignmentListInstance {
_version: V1;
_solution: CustomerProfilesChannelEndpointAssignmentSolution;
_uri: string;
(sid: string): CustomerProfilesChannelEndpointAssignmentContext;
get(sid: string): CustomerProfilesChannelEndpointAssignmentContext;
/**
* Create a CustomerProfilesChannelEndpointAssignmentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance
*/
create(params: CustomerProfilesChannelEndpointAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>;
/**
* Create a CustomerProfilesChannelEndpointAssignmentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance with HTTP metadata
*/
createWithHttpInfo(params: CustomerProfilesChannelEndpointAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance>>;
/**
* Streams CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
each(params: CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions, callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions, callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CustomerProfilesChannelEndpointAssignmentInstance 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: CustomerProfilesChannelEndpointAssignmentPage) => any): Promise<CustomerProfilesChannelEndpointAssignmentPage>;
/**
* Retrieve a single target page of CustomerProfilesChannelEndpointAssignmentInstance 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<CustomerProfilesChannelEndpointAssignmentPage>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentPage>>;
/**
* Lists CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentInstance[]) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance[]>;
list(params: CustomerProfilesChannelEndpointAssignmentListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentInstance[]) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance[]>;
/**
* Lists CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance[]>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance[]>>;
listWithHttpInfo(params: CustomerProfilesChannelEndpointAssignmentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance[]>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentInstance[]>>;
/**
* Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentPage) => any): Promise<CustomerProfilesChannelEndpointAssignmentPage>;
page(params: CustomerProfilesChannelEndpointAssignmentListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentPage) => any): Promise<CustomerProfilesChannelEndpointAssignmentPage>;
/**
* Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesChannelEndpointAssignmentPage>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentPage>>;
pageWithHttpInfo(params: CustomerProfilesChannelEndpointAssignmentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesChannelEndpointAssignmentPage>) => any): Promise<ApiResponse<CustomerProfilesChannelEndpointAssignmentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CustomerProfilesChannelEndpointAssignmentListInstance(version: V1, customerProfileSid: string): CustomerProfilesChannelEndpointAssignmentListInstance;
export declare class CustomerProfilesChannelEndpointAssignmentPage extends Page<V1, CustomerProfilesChannelEndpointAssignmentPayload, CustomerProfilesChannelEndpointAssignmentResource, CustomerProfilesChannelEndpointAssignmentInstance> {
/**
* Initialize the CustomerProfilesChannelEndpointAssignmentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CustomerProfilesChannelEndpointAssignmentSolution);
/**
* Build an instance of CustomerProfilesChannelEndpointAssignmentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CustomerProfilesChannelEndpointAssignmentResource): CustomerProfilesChannelEndpointAssignmentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,376 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.CustomerProfilesChannelEndpointAssignmentPage = exports.CustomerProfilesChannelEndpointAssignmentInstance = exports.CustomerProfilesChannelEndpointAssignmentContextImpl = void 0;
exports.CustomerProfilesChannelEndpointAssignmentListInstance = CustomerProfilesChannelEndpointAssignmentListInstance;
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 CustomerProfilesChannelEndpointAssignmentContextImpl {
constructor(_version, customerProfileSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(customerProfileSid)) {
throw new Error("Parameter 'customerProfileSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { customerProfileSid, sid };
this._uri = `/CustomerProfiles/${customerProfileSid}/ChannelEndpointAssignments/${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 CustomerProfilesChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.customerProfileSid, 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 CustomerProfilesChannelEndpointAssignmentInstance(operationVersion, response.body, instance._solution.customerProfileSid, 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.CustomerProfilesChannelEndpointAssignmentContextImpl = CustomerProfilesChannelEndpointAssignmentContextImpl;
class CustomerProfilesChannelEndpointAssignmentInstance {
constructor(_version, payload, customerProfileSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.customerProfileSid = payload.customer_profile_sid;
this.accountSid = payload.account_sid;
this.channelEndpointType = payload.channel_endpoint_type;
this.channelEndpointSid = payload.channel_endpoint_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.url = payload.url;
this._solution = { customerProfileSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CustomerProfilesChannelEndpointAssignmentContextImpl(this._version, this._solution.customerProfileSid, this._solution.sid);
return this._context;
}
/**
* Remove a CustomerProfilesChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a CustomerProfilesChannelEndpointAssignmentInstance 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 CustomerProfilesChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CustomerProfilesChannelEndpointAssignmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
customerProfileSid: this.customerProfileSid,
accountSid: this.accountSid,
channelEndpointType: this.channelEndpointType,
channelEndpointSid: this.channelEndpointSid,
dateCreated: this.dateCreated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesChannelEndpointAssignmentInstance = CustomerProfilesChannelEndpointAssignmentInstance;
function CustomerProfilesChannelEndpointAssignmentListInstance(version, customerProfileSid) {
if (!(0, utility_1.isValidPathParam)(customerProfileSid)) {
throw new Error("Parameter 'customerProfileSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CustomerProfilesChannelEndpointAssignmentContextImpl(version, customerProfileSid, sid);
};
instance._version = version;
instance._solution = { customerProfileSid };
instance._uri = `/CustomerProfiles/${customerProfileSid}/ChannelEndpointAssignments`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["channelEndpointType"] === null ||
params["channelEndpointType"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointType']\" missing.");
}
if (params["channelEndpointSid"] === null ||
params["channelEndpointSid"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointSid']\" missing.");
}
let data = {};
data["ChannelEndpointType"] = params["channelEndpointType"];
data["ChannelEndpointSid"] = params["channelEndpointSid"];
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 CustomerProfilesChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.customerProfileSid));
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["channelEndpointType"] === null ||
params["channelEndpointType"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointType']\" missing.");
}
if (params["channelEndpointSid"] === null ||
params["channelEndpointSid"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointSid']\" missing.");
}
let data = {};
data["ChannelEndpointType"] = params["channelEndpointType"];
data["ChannelEndpointSid"] = params["channelEndpointSid"];
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 CustomerProfilesChannelEndpointAssignmentInstance(operationVersion, response.body, instance._solution.customerProfileSid),
}));
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["channelEndpointSid"] !== undefined)
data["ChannelEndpointSid"] = params["channelEndpointSid"];
if (params["channelEndpointSids"] !== undefined)
data["ChannelEndpointSids"] = params["channelEndpointSids"];
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 CustomerProfilesChannelEndpointAssignmentPage(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 CustomerProfilesChannelEndpointAssignmentPage(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["channelEndpointSid"] !== undefined)
data["ChannelEndpointSid"] = params["channelEndpointSid"];
if (params["channelEndpointSids"] !== undefined)
data["ChannelEndpointSids"] = params["channelEndpointSids"];
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 CustomerProfilesChannelEndpointAssignmentPage(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 CustomerProfilesChannelEndpointAssignmentPage(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 CustomerProfilesChannelEndpointAssignmentPage extends Page_1.default {
/**
* Initialize the CustomerProfilesChannelEndpointAssignmentPage
*
* @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 CustomerProfilesChannelEndpointAssignmentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CustomerProfilesChannelEndpointAssignmentInstance(this._version, payload, this._solution.customerProfileSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesChannelEndpointAssignmentPage = CustomerProfilesChannelEndpointAssignmentPage;

View File

@@ -0,0 +1,353 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a CustomerProfilesEntityAssignmentsInstance
*/
export interface CustomerProfilesEntityAssignmentsListInstanceCreateOptions {
/** The SID of an object bag that holds information of the different items. */
objectSid: string;
}
/**
* Options to pass to each
*/
export interface CustomerProfilesEntityAssignmentsListInstanceEachOptions {
/** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */
objectType?: 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: CustomerProfilesEntityAssignmentsInstance, 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 CustomerProfilesEntityAssignmentsListInstanceOptions {
/** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */
objectType?: 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 CustomerProfilesEntityAssignmentsListInstancePageOptions {
/** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */
objectType?: 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 CustomerProfilesEntityAssignmentsContext {
/**
* Remove a CustomerProfilesEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>;
/**
* Fetch a CustomerProfilesEntityAssignmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEntityAssignmentsInstance>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CustomerProfilesEntityAssignmentsContextSolution {
customerProfileSid: string;
sid: string;
}
export declare class CustomerProfilesEntityAssignmentsContextImpl implements CustomerProfilesEntityAssignmentsContext {
protected _version: V1;
protected _solution: CustomerProfilesEntityAssignmentsContextSolution;
protected _uri: string;
constructor(_version: V1, customerProfileSid: 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?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEntityAssignmentsInstance>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CustomerProfilesEntityAssignmentsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CustomerProfilesEntityAssignmentsPayload extends TwilioResponsePayload {
results: CustomerProfilesEntityAssignmentsResource[];
}
interface CustomerProfilesEntityAssignmentsResource {
sid: string;
customer_profile_sid: string;
account_sid: string;
object_sid: string;
date_created: Date;
url: string;
}
export declare class CustomerProfilesEntityAssignmentsInstance {
protected _version: V1;
protected _solution: CustomerProfilesEntityAssignmentsContextSolution;
protected _context?: CustomerProfilesEntityAssignmentsContext;
constructor(_version: V1, payload: CustomerProfilesEntityAssignmentsResource, customerProfileSid: string, sid?: string);
/**
* The unique string that we created to identify the Item Assignment resource.
*/
sid: string;
/**
* The unique string that we created to identify the CustomerProfile resource.
*/
customerProfileSid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
*/
accountSid: string;
/**
* The SID of an object bag that holds information of the different items.
*/
objectSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The absolute URL of the Identity resource.
*/
url: string;
private get _proxy();
/**
* Remove a CustomerProfilesEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>;
/**
* Fetch a CustomerProfilesEntityAssignmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEntityAssignmentsInstance>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
customerProfileSid: string;
accountSid: string;
objectSid: string;
dateCreated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CustomerProfilesEntityAssignmentsSolution {
customerProfileSid: string;
}
export interface CustomerProfilesEntityAssignmentsListInstance {
_version: V1;
_solution: CustomerProfilesEntityAssignmentsSolution;
_uri: string;
(sid: string): CustomerProfilesEntityAssignmentsContext;
get(sid: string): CustomerProfilesEntityAssignmentsContext;
/**
* Create a CustomerProfilesEntityAssignmentsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance
*/
create(params: CustomerProfilesEntityAssignmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>;
/**
* Create a CustomerProfilesEntityAssignmentsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance with HTTP metadata
*/
createWithHttpInfo(params: CustomerProfilesEntityAssignmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEntityAssignmentsInstance>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsInstance>>;
/**
* Streams CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CustomerProfilesEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
each(params: CustomerProfilesEntityAssignmentsListInstanceEachOptions, callback?: (item: CustomerProfilesEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CustomerProfilesEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CustomerProfilesEntityAssignmentsListInstanceEachOptions, callback?: (item: CustomerProfilesEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CustomerProfilesEntityAssignmentsInstance 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: CustomerProfilesEntityAssignmentsPage) => any): Promise<CustomerProfilesEntityAssignmentsPage>;
/**
* Retrieve a single target page of CustomerProfilesEntityAssignmentsInstance 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<CustomerProfilesEntityAssignmentsPage>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsPage>>;
/**
* Lists CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsInstance[]) => any): Promise<CustomerProfilesEntityAssignmentsInstance[]>;
list(params: CustomerProfilesEntityAssignmentsListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsInstance[]) => any): Promise<CustomerProfilesEntityAssignmentsInstance[]>;
/**
* Lists CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEntityAssignmentsInstance[]>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsInstance[]>>;
listWithHttpInfo(params: CustomerProfilesEntityAssignmentsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEntityAssignmentsInstance[]>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsInstance[]>>;
/**
* Retrieve a single page of CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsPage) => any): Promise<CustomerProfilesEntityAssignmentsPage>;
page(params: CustomerProfilesEntityAssignmentsListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsPage) => any): Promise<CustomerProfilesEntityAssignmentsPage>;
/**
* Retrieve a single page of CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEntityAssignmentsPage>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsPage>>;
pageWithHttpInfo(params: CustomerProfilesEntityAssignmentsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEntityAssignmentsPage>) => any): Promise<ApiResponse<CustomerProfilesEntityAssignmentsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CustomerProfilesEntityAssignmentsListInstance(version: V1, customerProfileSid: string): CustomerProfilesEntityAssignmentsListInstance;
export declare class CustomerProfilesEntityAssignmentsPage extends Page<V1, CustomerProfilesEntityAssignmentsPayload, CustomerProfilesEntityAssignmentsResource, CustomerProfilesEntityAssignmentsInstance> {
/**
* Initialize the CustomerProfilesEntityAssignmentsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CustomerProfilesEntityAssignmentsSolution);
/**
* Build an instance of CustomerProfilesEntityAssignmentsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CustomerProfilesEntityAssignmentsResource): CustomerProfilesEntityAssignmentsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,367 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.CustomerProfilesEntityAssignmentsPage = exports.CustomerProfilesEntityAssignmentsInstance = exports.CustomerProfilesEntityAssignmentsContextImpl = void 0;
exports.CustomerProfilesEntityAssignmentsListInstance = CustomerProfilesEntityAssignmentsListInstance;
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 CustomerProfilesEntityAssignmentsContextImpl {
constructor(_version, customerProfileSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(customerProfileSid)) {
throw new Error("Parameter 'customerProfileSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { customerProfileSid, sid };
this._uri = `/CustomerProfiles/${customerProfileSid}/EntityAssignments/${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 CustomerProfilesEntityAssignmentsInstance(operationVersion, payload, instance._solution.customerProfileSid, 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 CustomerProfilesEntityAssignmentsInstance(operationVersion, response.body, instance._solution.customerProfileSid, 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.CustomerProfilesEntityAssignmentsContextImpl = CustomerProfilesEntityAssignmentsContextImpl;
class CustomerProfilesEntityAssignmentsInstance {
constructor(_version, payload, customerProfileSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.customerProfileSid = payload.customer_profile_sid;
this.accountSid = payload.account_sid;
this.objectSid = payload.object_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.url = payload.url;
this._solution = { customerProfileSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CustomerProfilesEntityAssignmentsContextImpl(this._version, this._solution.customerProfileSid, this._solution.sid);
return this._context;
}
/**
* Remove a CustomerProfilesEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CustomerProfilesEntityAssignmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
customerProfileSid: this.customerProfileSid,
accountSid: this.accountSid,
objectSid: this.objectSid,
dateCreated: this.dateCreated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesEntityAssignmentsInstance = CustomerProfilesEntityAssignmentsInstance;
function CustomerProfilesEntityAssignmentsListInstance(version, customerProfileSid) {
if (!(0, utility_1.isValidPathParam)(customerProfileSid)) {
throw new Error("Parameter 'customerProfileSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CustomerProfilesEntityAssignmentsContextImpl(version, customerProfileSid, sid);
};
instance._version = version;
instance._solution = { customerProfileSid };
instance._uri = `/CustomerProfiles/${customerProfileSid}/EntityAssignments`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["objectSid"] === null || params["objectSid"] === undefined) {
throw new Error("Required parameter \"params['objectSid']\" missing.");
}
let data = {};
data["ObjectSid"] = params["objectSid"];
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 CustomerProfilesEntityAssignmentsInstance(operationVersion, payload, instance._solution.customerProfileSid));
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["objectSid"] === null || params["objectSid"] === undefined) {
throw new Error("Required parameter \"params['objectSid']\" missing.");
}
let data = {};
data["ObjectSid"] = params["objectSid"];
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 CustomerProfilesEntityAssignmentsInstance(operationVersion, response.body, instance._solution.customerProfileSid),
}));
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["objectType"] !== undefined)
data["ObjectType"] = params["objectType"];
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 CustomerProfilesEntityAssignmentsPage(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 CustomerProfilesEntityAssignmentsPage(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["objectType"] !== undefined)
data["ObjectType"] = params["objectType"];
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 CustomerProfilesEntityAssignmentsPage(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 CustomerProfilesEntityAssignmentsPage(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 CustomerProfilesEntityAssignmentsPage extends Page_1.default {
/**
* Initialize the CustomerProfilesEntityAssignmentsPage
*
* @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 CustomerProfilesEntityAssignmentsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CustomerProfilesEntityAssignmentsInstance(this._version, payload, this._solution.customerProfileSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesEntityAssignmentsPage = CustomerProfilesEntityAssignmentsPage;

View File

@@ -0,0 +1,320 @@
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 compliance status of the Evaluation resource.
*/
export type CustomerProfilesEvaluationsStatus = "compliant" | "noncompliant";
/**
* Options to pass to create a CustomerProfilesEvaluationsInstance
*/
export interface CustomerProfilesEvaluationsListInstanceCreateOptions {
/** The unique string of a policy that is associated to the customer_profile resource. */
policySid: string;
}
/**
* Options to pass to each
*/
export interface CustomerProfilesEvaluationsListInstanceEachOptions {
/** 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: CustomerProfilesEvaluationsInstance, 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 CustomerProfilesEvaluationsListInstanceOptions {
/** 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 CustomerProfilesEvaluationsListInstancePageOptions {
/** 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 CustomerProfilesEvaluationsContext {
/**
* Fetch a CustomerProfilesEvaluationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>;
/**
* Fetch a CustomerProfilesEvaluationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEvaluationsInstance>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CustomerProfilesEvaluationsContextSolution {
customerProfileSid: string;
sid: string;
}
export declare class CustomerProfilesEvaluationsContextImpl implements CustomerProfilesEvaluationsContext {
protected _version: V1;
protected _solution: CustomerProfilesEvaluationsContextSolution;
protected _uri: string;
constructor(_version: V1, customerProfileSid: string, sid: string);
fetch(callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEvaluationsInstance>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CustomerProfilesEvaluationsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CustomerProfilesEvaluationsPayload extends TwilioResponsePayload {
results: CustomerProfilesEvaluationsResource[];
}
interface CustomerProfilesEvaluationsResource {
sid: string;
account_sid: string;
policy_sid: string;
customer_profile_sid: string;
status: CustomerProfilesEvaluationsStatus;
results: Array<any>;
date_created: Date;
url: string;
}
export declare class CustomerProfilesEvaluationsInstance {
protected _version: V1;
protected _solution: CustomerProfilesEvaluationsContextSolution;
protected _context?: CustomerProfilesEvaluationsContext;
constructor(_version: V1, payload: CustomerProfilesEvaluationsResource, customerProfileSid: string, sid?: string);
/**
* The unique string that identifies the Evaluation resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the customer_profile resource.
*/
accountSid: string;
/**
* The unique string of a policy that is associated to the customer_profile resource.
*/
policySid: string;
/**
* The unique string that we created to identify the customer_profile resource.
*/
customerProfileSid: string;
status: CustomerProfilesEvaluationsStatus;
/**
* The results of the Evaluation which includes the valid and invalid attributes.
*/
results: Array<any>;
dateCreated: Date;
url: string;
private get _proxy();
/**
* Fetch a CustomerProfilesEvaluationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance
*/
fetch(callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>;
/**
* Fetch a CustomerProfilesEvaluationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEvaluationsInstance>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
policySid: string;
customerProfileSid: string;
status: CustomerProfilesEvaluationsStatus;
results: any[];
dateCreated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CustomerProfilesEvaluationsSolution {
customerProfileSid: string;
}
export interface CustomerProfilesEvaluationsListInstance {
_version: V1;
_solution: CustomerProfilesEvaluationsSolution;
_uri: string;
(sid: string): CustomerProfilesEvaluationsContext;
get(sid: string): CustomerProfilesEvaluationsContext;
/**
* Create a CustomerProfilesEvaluationsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance
*/
create(params: CustomerProfilesEvaluationsListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>;
/**
* Create a CustomerProfilesEvaluationsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance with HTTP metadata
*/
createWithHttpInfo(params: CustomerProfilesEvaluationsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomerProfilesEvaluationsInstance>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsInstance>>;
/**
* Streams CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CustomerProfilesEvaluationsInstance, done: (err?: Error) => void) => void): void;
each(params: CustomerProfilesEvaluationsListInstanceEachOptions, callback?: (item: CustomerProfilesEvaluationsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CustomerProfilesEvaluationsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CustomerProfilesEvaluationsListInstanceEachOptions, callback?: (item: CustomerProfilesEvaluationsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CustomerProfilesEvaluationsInstance 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: CustomerProfilesEvaluationsPage) => any): Promise<CustomerProfilesEvaluationsPage>;
/**
* Retrieve a single target page of CustomerProfilesEvaluationsInstance 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<CustomerProfilesEvaluationsPage>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsPage>>;
/**
* Lists CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CustomerProfilesEvaluationsInstance[]) => any): Promise<CustomerProfilesEvaluationsInstance[]>;
list(params: CustomerProfilesEvaluationsListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesEvaluationsInstance[]) => any): Promise<CustomerProfilesEvaluationsInstance[]>;
/**
* Lists CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEvaluationsInstance[]>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsInstance[]>>;
listWithHttpInfo(params: CustomerProfilesEvaluationsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEvaluationsInstance[]>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsInstance[]>>;
/**
* Retrieve a single page of CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CustomerProfilesEvaluationsPage) => any): Promise<CustomerProfilesEvaluationsPage>;
page(params: CustomerProfilesEvaluationsListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesEvaluationsPage) => any): Promise<CustomerProfilesEvaluationsPage>;
/**
* Retrieve a single page of CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEvaluationsPage>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsPage>>;
pageWithHttpInfo(params: CustomerProfilesEvaluationsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CustomerProfilesEvaluationsPage>) => any): Promise<ApiResponse<CustomerProfilesEvaluationsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CustomerProfilesEvaluationsListInstance(version: V1, customerProfileSid: string): CustomerProfilesEvaluationsListInstance;
export declare class CustomerProfilesEvaluationsPage extends Page<V1, CustomerProfilesEvaluationsPayload, CustomerProfilesEvaluationsResource, CustomerProfilesEvaluationsInstance> {
/**
* Initialize the CustomerProfilesEvaluationsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CustomerProfilesEvaluationsSolution);
/**
* Build an instance of CustomerProfilesEvaluationsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CustomerProfilesEvaluationsResource): CustomerProfilesEvaluationsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,322 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.CustomerProfilesEvaluationsPage = exports.CustomerProfilesEvaluationsInstance = exports.CustomerProfilesEvaluationsContextImpl = void 0;
exports.CustomerProfilesEvaluationsListInstance = CustomerProfilesEvaluationsListInstance;
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 CustomerProfilesEvaluationsContextImpl {
constructor(_version, customerProfileSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(customerProfileSid)) {
throw new Error("Parameter 'customerProfileSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { customerProfileSid, sid };
this._uri = `/CustomerProfiles/${customerProfileSid}/Evaluations/${sid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new CustomerProfilesEvaluationsInstance(operationVersion, payload, instance._solution.customerProfileSid, 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 CustomerProfilesEvaluationsInstance(operationVersion, response.body, instance._solution.customerProfileSid, 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.CustomerProfilesEvaluationsContextImpl = CustomerProfilesEvaluationsContextImpl;
class CustomerProfilesEvaluationsInstance {
constructor(_version, payload, customerProfileSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.policySid = payload.policy_sid;
this.customerProfileSid = payload.customer_profile_sid;
this.status = payload.status;
this.results = payload.results;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.url = payload.url;
this._solution = { customerProfileSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CustomerProfilesEvaluationsContextImpl(this._version, this._solution.customerProfileSid, this._solution.sid);
return this._context;
}
/**
* Fetch a CustomerProfilesEvaluationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CustomerProfilesEvaluationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomerProfilesEvaluationsInstance 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,
policySid: this.policySid,
customerProfileSid: this.customerProfileSid,
status: this.status,
results: this.results,
dateCreated: this.dateCreated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesEvaluationsInstance = CustomerProfilesEvaluationsInstance;
function CustomerProfilesEvaluationsListInstance(version, customerProfileSid) {
if (!(0, utility_1.isValidPathParam)(customerProfileSid)) {
throw new Error("Parameter 'customerProfileSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CustomerProfilesEvaluationsContextImpl(version, customerProfileSid, sid);
};
instance._version = version;
instance._solution = { customerProfileSid };
instance._uri = `/CustomerProfiles/${customerProfileSid}/Evaluations`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["PolicySid"] = params["policySid"];
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 CustomerProfilesEvaluationsInstance(operationVersion, payload, instance._solution.customerProfileSid));
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["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["PolicySid"] = params["policySid"];
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 CustomerProfilesEvaluationsInstance(operationVersion, response.body, instance._solution.customerProfileSid),
}));
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 CustomerProfilesEvaluationsPage(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 CustomerProfilesEvaluationsPage(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 CustomerProfilesEvaluationsPage(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 CustomerProfilesEvaluationsPage(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 CustomerProfilesEvaluationsPage extends Page_1.default {
/**
* Initialize the CustomerProfilesEvaluationsPage
*
* @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 CustomerProfilesEvaluationsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CustomerProfilesEvaluationsInstance(this._version, payload, this._solution.customerProfileSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomerProfilesEvaluationsPage = CustomerProfilesEvaluationsPage;

440
node_modules/twilio/lib/rest/trusthub/v1/endUser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,440 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to update a EndUserInstance
*/
export interface EndUserContextUpdateOptions {
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The set of parameters that are the attributes of the End User resource which are derived End User Types. */
attributes?: any;
}
/**
* Options to pass to create a EndUserInstance
*/
export interface EndUserListInstanceCreateOptions {
/** The string that you assigned to describe the resource. */
friendlyName: string;
/** The type of end user of the Bundle resource - can be `individual` or `business`. */
type: string;
/** The set of parameters that are the attributes of the End User resource which are derived End User Types. */
attributes?: any;
}
/**
* Options to pass to each
*/
export interface EndUserListInstanceEachOptions {
/** 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: EndUserInstance, 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 EndUserListInstanceOptions {
/** 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 EndUserListInstancePageOptions {
/** 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 EndUserContext {
/**
* Remove a EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a EndUserInstance 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 EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Fetch a EndUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Update a EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
update(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Update a EndUserInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
update(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Update a EndUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Update a EndUserInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
updateWithHttpInfo(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EndUserContextSolution {
sid: string;
}
export declare class EndUserContextImpl implements EndUserContext {
protected _version: V1;
protected _solution: EndUserContextSolution;
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?: EndUserInstance) => any): Promise<EndUserInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
update(params?: EndUserContextUpdateOptions | ((error: Error | null, item?: EndUserInstance) => any), callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
updateWithHttpInfo(params?: EndUserContextUpdateOptions | ((error: Error | null, item?: ApiResponse<EndUserInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EndUserContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EndUserPayload extends TwilioResponsePayload {
results: EndUserResource[];
}
interface EndUserResource {
sid: string;
account_sid: string;
friendly_name: string;
type: string;
attributes: any;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class EndUserInstance {
protected _version: V1;
protected _solution: EndUserContextSolution;
protected _context?: EndUserContext;
constructor(_version: V1, payload: EndUserResource, sid?: string);
/**
* The unique string created by Twilio to identify the End User resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The type of end user of the Bundle resource - can be `individual` or `business`.
*/
type: string;
/**
* The set of parameters that are the attributes of the End Users resource which are listed in the End User Types.
*/
attributes: any;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the End User resource.
*/
url: string;
private get _proxy();
/**
* Remove a EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a EndUserInstance 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 EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Fetch a EndUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Update a EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
update(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Update a EndUserInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
update(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Update a EndUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Update a EndUserInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
updateWithHttpInfo(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
type: string;
attributes: any;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EndUserSolution {
}
export interface EndUserListInstance {
_version: V1;
_solution: EndUserSolution;
_uri: string;
(sid: string): EndUserContext;
get(sid: string): EndUserContext;
/**
* Create a EndUserInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
create(params: EndUserListInstanceCreateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>;
/**
* Create a EndUserInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance with HTTP metadata
*/
createWithHttpInfo(params: EndUserListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<EndUserInstance>) => any): Promise<ApiResponse<EndUserInstance>>;
/**
* Streams EndUserInstance 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 { EndUserListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void;
each(params: EndUserListInstanceEachOptions, callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void;
/**
* Streams EndUserInstance 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 { EndUserListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: EndUserListInstanceEachOptions, callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of EndUserInstance 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: EndUserPage) => any): Promise<EndUserPage>;
/**
* Retrieve a single target page of EndUserInstance 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<EndUserPage>) => any): Promise<ApiResponse<EndUserPage>>;
/**
* Lists EndUserInstance 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 { EndUserListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: EndUserInstance[]) => any): Promise<EndUserInstance[]>;
list(params: EndUserListInstanceOptions, callback?: (error: Error | null, items: EndUserInstance[]) => any): Promise<EndUserInstance[]>;
/**
* Lists EndUserInstance 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 { EndUserListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EndUserInstance[]>) => any): Promise<ApiResponse<EndUserInstance[]>>;
listWithHttpInfo(params: EndUserListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EndUserInstance[]>) => any): Promise<ApiResponse<EndUserInstance[]>>;
/**
* Retrieve a single page of EndUserInstance 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 { EndUserListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: EndUserPage) => any): Promise<EndUserPage>;
page(params: EndUserListInstancePageOptions, callback?: (error: Error | null, items: EndUserPage) => any): Promise<EndUserPage>;
/**
* Retrieve a single page of EndUserInstance 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 { EndUserListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EndUserPage>) => any): Promise<ApiResponse<EndUserPage>>;
pageWithHttpInfo(params: EndUserListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EndUserPage>) => any): Promise<ApiResponse<EndUserPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EndUserListInstance(version: V1): EndUserListInstance;
export declare class EndUserPage extends Page<V1, EndUserPayload, EndUserResource, EndUserInstance> {
/**
* Initialize the EndUserPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: EndUserSolution);
/**
* Build an instance of EndUserInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: EndUserResource): EndUserInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

441
node_modules/twilio/lib/rest/trusthub/v1/endUser.js generated vendored Normal file
View File

@@ -0,0 +1,441 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.EndUserPage = exports.EndUserInstance = exports.EndUserContextImpl = void 0;
exports.EndUserListInstance = EndUserListInstance;
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 EndUserContextImpl {
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 = `/EndUsers/${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 EndUserInstance(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 EndUserInstance(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["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 EndUserInstance(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["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 EndUserInstance(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.EndUserContextImpl = EndUserContextImpl;
class EndUserInstance {
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.attributes = payload.attributes;
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 EndUserContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a EndUserInstance 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 EndUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a EndUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserInstance 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,
attributes: this.attributes,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EndUserInstance = EndUserInstance;
function EndUserListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new EndUserContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/EndUsers`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["type"] === null || params["type"] === undefined) {
throw new Error("Required parameter \"params['type']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Type"] = params["type"];
if (params["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 EndUserInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["type"] === null || params["type"] === undefined) {
throw new Error("Required parameter \"params['type']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Type"] = params["type"];
if (params["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 EndUserInstance(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 EndUserPage(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 EndUserPage(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 EndUserPage(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 EndUserPage(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 EndUserPage extends Page_1.default {
/**
* Initialize the EndUserPage
*
* @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 EndUserInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new EndUserInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EndUserPage = EndUserPage;

View File

@@ -0,0 +1,280 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface EndUserTypeListInstanceEachOptions {
/** 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: EndUserTypeInstance, 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 EndUserTypeListInstanceOptions {
/** 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 EndUserTypeListInstancePageOptions {
/** 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 EndUserTypeContext {
/**
* Fetch a EndUserTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserTypeInstance
*/
fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>;
/**
* Fetch a EndUserTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserTypeInstance>) => any): Promise<ApiResponse<EndUserTypeInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EndUserTypeContextSolution {
sid: string;
}
export declare class EndUserTypeContextImpl implements EndUserTypeContext {
protected _version: V1;
protected _solution: EndUserTypeContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserTypeInstance>) => any): Promise<ApiResponse<EndUserTypeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EndUserTypeContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EndUserTypePayload extends TwilioResponsePayload {
end_user_types: EndUserTypeResource[];
}
interface EndUserTypeResource {
sid: string;
friendly_name: string;
machine_name: string;
fields: Array<any>;
url: string;
}
export declare class EndUserTypeInstance {
protected _version: V1;
protected _solution: EndUserTypeContextSolution;
protected _context?: EndUserTypeContext;
constructor(_version: V1, payload: EndUserTypeResource, sid?: string);
/**
* The unique string that identifies the End-User Type resource.
*/
sid: string;
/**
* A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc
*/
friendlyName: string;
/**
* A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc.
*/
machineName: string;
/**
* The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals.
*/
fields: Array<any>;
/**
* The absolute URL of the End-User Type resource.
*/
url: string;
private get _proxy();
/**
* Fetch a EndUserTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserTypeInstance
*/
fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>;
/**
* Fetch a EndUserTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EndUserTypeInstance>) => any): Promise<ApiResponse<EndUserTypeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
friendlyName: string;
machineName: string;
fields: any[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EndUserTypeSolution {
}
export interface EndUserTypeListInstance {
_version: V1;
_solution: EndUserTypeSolution;
_uri: string;
(sid: string): EndUserTypeContext;
get(sid: string): EndUserTypeContext;
/**
* Streams EndUserTypeInstance 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 { EndUserTypeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void;
each(params: EndUserTypeListInstanceEachOptions, callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void;
/**
* Streams EndUserTypeInstance 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 { EndUserTypeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: EndUserTypeListInstanceEachOptions, callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of EndUserTypeInstance 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: EndUserTypePage) => any): Promise<EndUserTypePage>;
/**
* Retrieve a single target page of EndUserTypeInstance 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<EndUserTypePage>) => any): Promise<ApiResponse<EndUserTypePage>>;
/**
* Lists EndUserTypeInstance 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 { EndUserTypeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: EndUserTypeInstance[]) => any): Promise<EndUserTypeInstance[]>;
list(params: EndUserTypeListInstanceOptions, callback?: (error: Error | null, items: EndUserTypeInstance[]) => any): Promise<EndUserTypeInstance[]>;
/**
* Lists EndUserTypeInstance 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 { EndUserTypeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EndUserTypeInstance[]>) => any): Promise<ApiResponse<EndUserTypeInstance[]>>;
listWithHttpInfo(params: EndUserTypeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EndUserTypeInstance[]>) => any): Promise<ApiResponse<EndUserTypeInstance[]>>;
/**
* Retrieve a single page of EndUserTypeInstance 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 { EndUserTypeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: EndUserTypePage) => any): Promise<EndUserTypePage>;
page(params: EndUserTypeListInstancePageOptions, callback?: (error: Error | null, items: EndUserTypePage) => any): Promise<EndUserTypePage>;
/**
* Retrieve a single page of EndUserTypeInstance 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 { EndUserTypeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EndUserTypePage>) => any): Promise<ApiResponse<EndUserTypePage>>;
pageWithHttpInfo(params: EndUserTypeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EndUserTypePage>) => any): Promise<ApiResponse<EndUserTypePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EndUserTypeListInstance(version: V1): EndUserTypeListInstance;
export declare class EndUserTypePage extends Page<V1, EndUserTypePayload, EndUserTypeResource, EndUserTypeInstance> {
/**
* Initialize the EndUserTypePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: EndUserTypeSolution);
/**
* Build an instance of EndUserTypeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: EndUserTypeResource): EndUserTypeInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

260
node_modules/twilio/lib/rest/trusthub/v1/endUserType.js generated vendored Normal file
View File

@@ -0,0 +1,260 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.EndUserTypePage = exports.EndUserTypeInstance = exports.EndUserTypeContextImpl = void 0;
exports.EndUserTypeListInstance = EndUserTypeListInstance;
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 EndUserTypeContextImpl {
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 = `/EndUserTypes/${sid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new EndUserTypeInstance(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 EndUserTypeInstance(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.EndUserTypeContextImpl = EndUserTypeContextImpl;
class EndUserTypeInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.machineName = payload.machine_name;
this.fields = payload.fields;
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new EndUserTypeContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a EndUserTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserTypeInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a EndUserTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EndUserTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
friendlyName: this.friendlyName,
machineName: this.machineName,
fields: this.fields,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EndUserTypeInstance = EndUserTypeInstance;
function EndUserTypeListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new EndUserTypeContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/EndUserTypes`;
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 EndUserTypePage(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 EndUserTypePage(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 EndUserTypePage(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 EndUserTypePage(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 EndUserTypePage extends Page_1.default {
/**
* Initialize the EndUserTypePage
*
* @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 EndUserTypeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new EndUserTypeInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EndUserTypePage = EndUserTypePage;

274
node_modules/twilio/lib/rest/trusthub/v1/policies.d.ts generated vendored Normal file
View File

@@ -0,0 +1,274 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface PoliciesListInstanceEachOptions {
/** 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: PoliciesInstance, 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 PoliciesListInstanceOptions {
/** 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 PoliciesListInstancePageOptions {
/** 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 PoliciesContext {
/**
* Fetch a PoliciesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PoliciesInstance
*/
fetch(callback?: (error: Error | null, item?: PoliciesInstance) => any): Promise<PoliciesInstance>;
/**
* Fetch a PoliciesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PoliciesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PoliciesInstance>) => any): Promise<ApiResponse<PoliciesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PoliciesContextSolution {
sid: string;
}
export declare class PoliciesContextImpl implements PoliciesContext {
protected _version: V1;
protected _solution: PoliciesContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: PoliciesInstance) => any): Promise<PoliciesInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PoliciesInstance>) => any): Promise<ApiResponse<PoliciesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PoliciesContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PoliciesPayload extends TwilioResponsePayload {
results: PoliciesResource[];
}
interface PoliciesResource {
sid: string;
friendly_name: string;
requirements: any;
url: string;
}
export declare class PoliciesInstance {
protected _version: V1;
protected _solution: PoliciesContextSolution;
protected _context?: PoliciesContext;
constructor(_version: V1, payload: PoliciesResource, sid?: string);
/**
* The unique string that identifies the Policy resource.
*/
sid: string;
/**
* A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy
*/
friendlyName: string;
/**
* The SID of an object that holds the policy information
*/
requirements: any;
/**
* The absolute URL of the Policy resource.
*/
url: string;
private get _proxy();
/**
* Fetch a PoliciesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PoliciesInstance
*/
fetch(callback?: (error: Error | null, item?: PoliciesInstance) => any): Promise<PoliciesInstance>;
/**
* Fetch a PoliciesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PoliciesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PoliciesInstance>) => any): Promise<ApiResponse<PoliciesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
friendlyName: string;
requirements: any;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PoliciesSolution {
}
export interface PoliciesListInstance {
_version: V1;
_solution: PoliciesSolution;
_uri: string;
(sid: string): PoliciesContext;
get(sid: string): PoliciesContext;
/**
* Streams PoliciesInstance 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 { PoliciesListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: PoliciesInstance, done: (err?: Error) => void) => void): void;
each(params: PoliciesListInstanceEachOptions, callback?: (item: PoliciesInstance, done: (err?: Error) => void) => void): void;
/**
* Streams PoliciesInstance 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 { PoliciesListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: PoliciesInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: PoliciesListInstanceEachOptions, callback?: (item: PoliciesInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of PoliciesInstance 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: PoliciesPage) => any): Promise<PoliciesPage>;
/**
* Retrieve a single target page of PoliciesInstance 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<PoliciesPage>) => any): Promise<ApiResponse<PoliciesPage>>;
/**
* Lists PoliciesInstance 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 { PoliciesListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: PoliciesInstance[]) => any): Promise<PoliciesInstance[]>;
list(params: PoliciesListInstanceOptions, callback?: (error: Error | null, items: PoliciesInstance[]) => any): Promise<PoliciesInstance[]>;
/**
* Lists PoliciesInstance 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 { PoliciesListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PoliciesInstance[]>) => any): Promise<ApiResponse<PoliciesInstance[]>>;
listWithHttpInfo(params: PoliciesListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<PoliciesInstance[]>) => any): Promise<ApiResponse<PoliciesInstance[]>>;
/**
* Retrieve a single page of PoliciesInstance 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 { PoliciesListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: PoliciesPage) => any): Promise<PoliciesPage>;
page(params: PoliciesListInstancePageOptions, callback?: (error: Error | null, items: PoliciesPage) => any): Promise<PoliciesPage>;
/**
* Retrieve a single page of PoliciesInstance 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 { PoliciesListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PoliciesPage>) => any): Promise<ApiResponse<PoliciesPage>>;
pageWithHttpInfo(params: PoliciesListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<PoliciesPage>) => any): Promise<ApiResponse<PoliciesPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PoliciesListInstance(version: V1): PoliciesListInstance;
export declare class PoliciesPage extends Page<V1, PoliciesPayload, PoliciesResource, PoliciesInstance> {
/**
* Initialize the PoliciesPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: PoliciesSolution);
/**
* Build an instance of PoliciesInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: PoliciesResource): PoliciesInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

258
node_modules/twilio/lib/rest/trusthub/v1/policies.js generated vendored Normal file
View File

@@ -0,0 +1,258 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.PoliciesPage = exports.PoliciesInstance = exports.PoliciesContextImpl = void 0;
exports.PoliciesListInstance = PoliciesListInstance;
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 PoliciesContextImpl {
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 = `/Policies/${sid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new PoliciesInstance(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 PoliciesInstance(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.PoliciesContextImpl = PoliciesContextImpl;
class PoliciesInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.requirements = payload.requirements;
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new PoliciesContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a PoliciesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PoliciesInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a PoliciesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PoliciesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
friendlyName: this.friendlyName,
requirements: this.requirements,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PoliciesInstance = PoliciesInstance;
function PoliciesListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new PoliciesContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Policies`;
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 PoliciesPage(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 PoliciesPage(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 PoliciesPage(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 PoliciesPage(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 PoliciesPage extends Page_1.default {
/**
* Initialize the PoliciesPage
*
* @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 PoliciesInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new PoliciesInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PoliciesPage = PoliciesPage;

View File

@@ -0,0 +1,453 @@
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 verification status of the Supporting Document resource.
*/
export type SupportingDocumentStatus = "DRAFT" | "PENDING_REVIEW" | "REJECTED" | "APPROVED" | "EXPIRED" | "PROVISIONALLY_APPROVED";
/**
* Options to pass to update a SupportingDocumentInstance
*/
export interface SupportingDocumentContextUpdateOptions {
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. */
attributes?: any;
}
/**
* Options to pass to create a SupportingDocumentInstance
*/
export interface SupportingDocumentListInstanceCreateOptions {
/** The string that you assigned to describe the resource. */
friendlyName: string;
/** The type of the Supporting Document. */
type: string;
/** The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. */
attributes?: any;
}
/**
* Options to pass to each
*/
export interface SupportingDocumentListInstanceEachOptions {
/** 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: SupportingDocumentInstance, 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 SupportingDocumentListInstanceOptions {
/** 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 SupportingDocumentListInstancePageOptions {
/** 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 SupportingDocumentContext {
/**
* Remove a SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SupportingDocumentInstance 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 SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Fetch a SupportingDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Update a SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
update(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Update a SupportingDocumentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
update(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Update a SupportingDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Update a SupportingDocumentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SupportingDocumentContextSolution {
sid: string;
}
export declare class SupportingDocumentContextImpl implements SupportingDocumentContext {
protected _version: V1;
protected _solution: SupportingDocumentContextSolution;
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?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
update(params?: SupportingDocumentContextUpdateOptions | ((error: Error | null, item?: SupportingDocumentInstance) => any), callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
updateWithHttpInfo(params?: SupportingDocumentContextUpdateOptions | ((error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SupportingDocumentContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SupportingDocumentPayload extends TwilioResponsePayload {
results: SupportingDocumentResource[];
}
interface SupportingDocumentResource {
sid: string;
account_sid: string;
friendly_name: string;
mime_type: string;
status: SupportingDocumentStatus;
type: string;
attributes: any;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class SupportingDocumentInstance {
protected _version: V1;
protected _solution: SupportingDocumentContextSolution;
protected _context?: SupportingDocumentContext;
constructor(_version: V1, payload: SupportingDocumentResource, sid?: string);
/**
* The unique string created by Twilio to identify the Supporting Document resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The image type uploaded in the Supporting Document container.
*/
mimeType: string;
status: SupportingDocumentStatus;
/**
* The type of the Supporting Document.
*/
type: string;
/**
* The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types.
*/
attributes: any;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the Supporting Document resource.
*/
url: string;
private get _proxy();
/**
* Remove a SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SupportingDocumentInstance 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 SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Fetch a SupportingDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Update a SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
update(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Update a SupportingDocumentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
update(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Update a SupportingDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Update a SupportingDocumentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
mimeType: string;
status: SupportingDocumentStatus;
type: string;
attributes: any;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SupportingDocumentSolution {
}
export interface SupportingDocumentListInstance {
_version: V1;
_solution: SupportingDocumentSolution;
_uri: string;
(sid: string): SupportingDocumentContext;
get(sid: string): SupportingDocumentContext;
/**
* Create a SupportingDocumentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
create(params: SupportingDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>;
/**
* Create a SupportingDocumentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance with HTTP metadata
*/
createWithHttpInfo(params: SupportingDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentInstance>) => any): Promise<ApiResponse<SupportingDocumentInstance>>;
/**
* Streams SupportingDocumentInstance 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 { SupportingDocumentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void;
each(params: SupportingDocumentListInstanceEachOptions, callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SupportingDocumentInstance 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 { SupportingDocumentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SupportingDocumentListInstanceEachOptions, callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SupportingDocumentInstance 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: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>;
/**
* Retrieve a single target page of SupportingDocumentInstance 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<SupportingDocumentPage>) => any): Promise<ApiResponse<SupportingDocumentPage>>;
/**
* Lists SupportingDocumentInstance 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 { SupportingDocumentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SupportingDocumentInstance[]) => any): Promise<SupportingDocumentInstance[]>;
list(params: SupportingDocumentListInstanceOptions, callback?: (error: Error | null, items: SupportingDocumentInstance[]) => any): Promise<SupportingDocumentInstance[]>;
/**
* Lists SupportingDocumentInstance 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 { SupportingDocumentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SupportingDocumentInstance[]>) => any): Promise<ApiResponse<SupportingDocumentInstance[]>>;
listWithHttpInfo(params: SupportingDocumentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SupportingDocumentInstance[]>) => any): Promise<ApiResponse<SupportingDocumentInstance[]>>;
/**
* Retrieve a single page of SupportingDocumentInstance 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 { SupportingDocumentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>;
page(params: SupportingDocumentListInstancePageOptions, callback?: (error: Error | null, items: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>;
/**
* Retrieve a single page of SupportingDocumentInstance 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 { SupportingDocumentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SupportingDocumentPage>) => any): Promise<ApiResponse<SupportingDocumentPage>>;
pageWithHttpInfo(params: SupportingDocumentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SupportingDocumentPage>) => any): Promise<ApiResponse<SupportingDocumentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SupportingDocumentListInstance(version: V1): SupportingDocumentListInstance;
export declare class SupportingDocumentPage extends Page<V1, SupportingDocumentPayload, SupportingDocumentResource, SupportingDocumentInstance> {
/**
* Initialize the SupportingDocumentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: SupportingDocumentSolution);
/**
* Build an instance of SupportingDocumentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SupportingDocumentResource): SupportingDocumentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,445 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.SupportingDocumentPage = exports.SupportingDocumentInstance = exports.SupportingDocumentContextImpl = void 0;
exports.SupportingDocumentListInstance = SupportingDocumentListInstance;
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 SupportingDocumentContextImpl {
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 = `/SupportingDocuments/${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 SupportingDocumentInstance(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 SupportingDocumentInstance(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["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 SupportingDocumentInstance(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["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 SupportingDocumentInstance(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.SupportingDocumentContextImpl = SupportingDocumentContextImpl;
class SupportingDocumentInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.mimeType = payload.mime_type;
this.status = payload.status;
this.type = payload.type;
this.attributes = payload.attributes;
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 SupportingDocumentContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a SupportingDocumentInstance 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 SupportingDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a SupportingDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentInstance 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,
mimeType: this.mimeType,
status: this.status,
type: this.type,
attributes: this.attributes,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SupportingDocumentInstance = SupportingDocumentInstance;
function SupportingDocumentListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new SupportingDocumentContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/SupportingDocuments`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["type"] === null || params["type"] === undefined) {
throw new Error("Required parameter \"params['type']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Type"] = params["type"];
if (params["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 SupportingDocumentInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["type"] === null || params["type"] === undefined) {
throw new Error("Required parameter \"params['type']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Type"] = params["type"];
if (params["attributes"] !== undefined)
data["Attributes"] = serialize.object(params["attributes"]);
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 SupportingDocumentInstance(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 SupportingDocumentPage(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 SupportingDocumentPage(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 SupportingDocumentPage(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 SupportingDocumentPage(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 SupportingDocumentPage extends Page_1.default {
/**
* Initialize the SupportingDocumentPage
*
* @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 SupportingDocumentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SupportingDocumentInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SupportingDocumentPage = SupportingDocumentPage;

View File

@@ -0,0 +1,280 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface SupportingDocumentTypeListInstanceEachOptions {
/** 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: SupportingDocumentTypeInstance, 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 SupportingDocumentTypeListInstanceOptions {
/** 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 SupportingDocumentTypeListInstancePageOptions {
/** 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 SupportingDocumentTypeContext {
/**
* Fetch a SupportingDocumentTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentTypeInstance
*/
fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>;
/**
* Fetch a SupportingDocumentTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentTypeInstance>) => any): Promise<ApiResponse<SupportingDocumentTypeInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SupportingDocumentTypeContextSolution {
sid: string;
}
export declare class SupportingDocumentTypeContextImpl implements SupportingDocumentTypeContext {
protected _version: V1;
protected _solution: SupportingDocumentTypeContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentTypeInstance>) => any): Promise<ApiResponse<SupportingDocumentTypeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SupportingDocumentTypeContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SupportingDocumentTypePayload extends TwilioResponsePayload {
supporting_document_types: SupportingDocumentTypeResource[];
}
interface SupportingDocumentTypeResource {
sid: string;
friendly_name: string;
machine_name: string;
fields: Array<any>;
url: string;
}
export declare class SupportingDocumentTypeInstance {
protected _version: V1;
protected _solution: SupportingDocumentTypeContextSolution;
protected _context?: SupportingDocumentTypeContext;
constructor(_version: V1, payload: SupportingDocumentTypeResource, sid?: string);
/**
* The unique string that identifies the Supporting Document Type resource.
*/
sid: string;
/**
* A human-readable description of the Supporting Document Type resource.
*/
friendlyName: string;
/**
* The machine-readable description of the Supporting Document Type resource.
*/
machineName: string;
/**
* The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals.
*/
fields: Array<any>;
/**
* The absolute URL of the Supporting Document Type resource.
*/
url: string;
private get _proxy();
/**
* Fetch a SupportingDocumentTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentTypeInstance
*/
fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>;
/**
* Fetch a SupportingDocumentTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SupportingDocumentTypeInstance>) => any): Promise<ApiResponse<SupportingDocumentTypeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
friendlyName: string;
machineName: string;
fields: any[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SupportingDocumentTypeSolution {
}
export interface SupportingDocumentTypeListInstance {
_version: V1;
_solution: SupportingDocumentTypeSolution;
_uri: string;
(sid: string): SupportingDocumentTypeContext;
get(sid: string): SupportingDocumentTypeContext;
/**
* Streams SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void;
each(params: SupportingDocumentTypeListInstanceEachOptions, callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SupportingDocumentTypeListInstanceEachOptions, callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SupportingDocumentTypeInstance 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: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>;
/**
* Retrieve a single target page of SupportingDocumentTypeInstance 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<SupportingDocumentTypePage>) => any): Promise<ApiResponse<SupportingDocumentTypePage>>;
/**
* Lists SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SupportingDocumentTypeInstance[]) => any): Promise<SupportingDocumentTypeInstance[]>;
list(params: SupportingDocumentTypeListInstanceOptions, callback?: (error: Error | null, items: SupportingDocumentTypeInstance[]) => any): Promise<SupportingDocumentTypeInstance[]>;
/**
* Lists SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SupportingDocumentTypeInstance[]>) => any): Promise<ApiResponse<SupportingDocumentTypeInstance[]>>;
listWithHttpInfo(params: SupportingDocumentTypeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SupportingDocumentTypeInstance[]>) => any): Promise<ApiResponse<SupportingDocumentTypeInstance[]>>;
/**
* Retrieve a single page of SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>;
page(params: SupportingDocumentTypeListInstancePageOptions, callback?: (error: Error | null, items: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>;
/**
* Retrieve a single page of SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SupportingDocumentTypePage>) => any): Promise<ApiResponse<SupportingDocumentTypePage>>;
pageWithHttpInfo(params: SupportingDocumentTypeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SupportingDocumentTypePage>) => any): Promise<ApiResponse<SupportingDocumentTypePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SupportingDocumentTypeListInstance(version: V1): SupportingDocumentTypeListInstance;
export declare class SupportingDocumentTypePage extends Page<V1, SupportingDocumentTypePayload, SupportingDocumentTypeResource, SupportingDocumentTypeInstance> {
/**
* Initialize the SupportingDocumentTypePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: SupportingDocumentTypeSolution);
/**
* Build an instance of SupportingDocumentTypeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SupportingDocumentTypeResource): SupportingDocumentTypeInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,260 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.SupportingDocumentTypePage = exports.SupportingDocumentTypeInstance = exports.SupportingDocumentTypeContextImpl = void 0;
exports.SupportingDocumentTypeListInstance = SupportingDocumentTypeListInstance;
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 SupportingDocumentTypeContextImpl {
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 = `/SupportingDocumentTypes/${sid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new SupportingDocumentTypeInstance(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 SupportingDocumentTypeInstance(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.SupportingDocumentTypeContextImpl = SupportingDocumentTypeContextImpl;
class SupportingDocumentTypeInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.machineName = payload.machine_name;
this.fields = payload.fields;
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new SupportingDocumentTypeContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a SupportingDocumentTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentTypeInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a SupportingDocumentTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SupportingDocumentTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
friendlyName: this.friendlyName,
machineName: this.machineName,
fields: this.fields,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SupportingDocumentTypeInstance = SupportingDocumentTypeInstance;
function SupportingDocumentTypeListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new SupportingDocumentTypeContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/SupportingDocumentTypes`;
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 SupportingDocumentTypePage(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 SupportingDocumentTypePage(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 SupportingDocumentTypePage(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 SupportingDocumentTypePage(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 SupportingDocumentTypePage extends Page_1.default {
/**
* Initialize the SupportingDocumentTypePage
*
* @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 SupportingDocumentTypeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SupportingDocumentTypeInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SupportingDocumentTypePage = SupportingDocumentTypePage;

View File

@@ -0,0 +1,519 @@
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 { TrustProductsChannelEndpointAssignmentListInstance } from "./trustProducts/trustProductsChannelEndpointAssignment";
import { TrustProductsEntityAssignmentsListInstance } from "./trustProducts/trustProductsEntityAssignments";
import { TrustProductsEvaluationsListInstance } from "./trustProducts/trustProductsEvaluations";
/**
* The verification status of the Trust Product resource.
*/
export type TrustProductsStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved";
/**
* Options to pass to update a TrustProductsInstance
*/
export interface TrustProductsContextUpdateOptions {
/** */
status?: TrustProductsStatus;
/** The URL we call to inform your application of status changes. */
statusCallback?: string;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The email address that will receive updates when the Trust Product resource changes status. */
email?: string;
}
/**
* Options to pass to create a TrustProductsInstance
*/
export interface TrustProductsListInstanceCreateOptions {
/** The string that you assigned to describe the resource. */
friendlyName: string;
/** The email address that will receive updates when the Trust Product resource changes status. */
email: string;
/** The unique string of a policy that is associated to the Trust Product resource. */
policySid: string;
/** The URL we call to inform your application of status changes. */
statusCallback?: string;
}
/**
* Options to pass to each
*/
export interface TrustProductsListInstanceEachOptions {
/** The verification status of the Trust Product resource. */
status?: TrustProductsStatus;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The unique string of a policy that is associated to the Trust Product resource. */
policySid?: 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: TrustProductsInstance, 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 TrustProductsListInstanceOptions {
/** The verification status of the Trust Product resource. */
status?: TrustProductsStatus;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The unique string of a policy that is associated to the Trust Product resource. */
policySid?: 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 TrustProductsListInstancePageOptions {
/** The verification status of the Trust Product resource. */
status?: TrustProductsStatus;
/** The string that you assigned to describe the resource. */
friendlyName?: string;
/** The unique string of a policy that is associated to the Trust Product resource. */
policySid?: 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 TrustProductsContext {
trustProductsChannelEndpointAssignment: TrustProductsChannelEndpointAssignmentListInstance;
trustProductsEntityAssignments: TrustProductsEntityAssignmentsListInstance;
trustProductsEvaluations: TrustProductsEvaluationsListInstance;
/**
* Remove a TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrustProductsInstance 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 TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Fetch a TrustProductsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Update a TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
update(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Update a TrustProductsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
update(params: TrustProductsContextUpdateOptions, callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Update a TrustProductsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Update a TrustProductsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
updateWithHttpInfo(params: TrustProductsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TrustProductsContextSolution {
sid: string;
}
export declare class TrustProductsContextImpl implements TrustProductsContext {
protected _version: V1;
protected _solution: TrustProductsContextSolution;
protected _uri: string;
protected _trustProductsChannelEndpointAssignment?: TrustProductsChannelEndpointAssignmentListInstance;
protected _trustProductsEntityAssignments?: TrustProductsEntityAssignmentsListInstance;
protected _trustProductsEvaluations?: TrustProductsEvaluationsListInstance;
constructor(_version: V1, sid: string);
get trustProductsChannelEndpointAssignment(): TrustProductsChannelEndpointAssignmentListInstance;
get trustProductsEntityAssignments(): TrustProductsEntityAssignmentsListInstance;
get trustProductsEvaluations(): TrustProductsEvaluationsListInstance;
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?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
update(params?: TrustProductsContextUpdateOptions | ((error: Error | null, item?: TrustProductsInstance) => any), callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
updateWithHttpInfo(params?: TrustProductsContextUpdateOptions | ((error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TrustProductsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TrustProductsPayload extends TwilioResponsePayload {
results: TrustProductsResource[];
}
interface TrustProductsResource {
sid: string;
account_sid: string;
policy_sid: string;
friendly_name: string;
status: TrustProductsStatus;
valid_until: Date;
email: string;
status_callback: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
errors: Array<any>;
}
export declare class TrustProductsInstance {
protected _version: V1;
protected _solution: TrustProductsContextSolution;
protected _context?: TrustProductsContext;
constructor(_version: V1, payload: TrustProductsResource, sid?: string);
/**
* The unique string that we created to identify the Trust Product resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trust Product resource.
*/
accountSid: string;
/**
* The unique string of the policy that is associated with the Trust Product resource.
*/
policySid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
status: TrustProductsStatus;
/**
* The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format until which the resource will be valid.
*/
validUntil: Date;
/**
* The email address that will receive updates when the Trust Product resource changes status.
*/
email: string;
/**
* The URL we call to inform your application of status changes.
*/
statusCallback: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the Trust Product resource.
*/
url: string;
/**
* The URLs of the Assigned Items of the Trust Product resource.
*/
links: Record<string, string>;
/**
* The error codes associated with the rejection of the Trust Product.
*/
errors: Array<any>;
private get _proxy();
/**
* Remove a TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrustProductsInstance 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 TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Fetch a TrustProductsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Update a TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
update(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Update a TrustProductsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
update(params: TrustProductsContextUpdateOptions, callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Update a TrustProductsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Update a TrustProductsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
updateWithHttpInfo(params: TrustProductsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Access the trustProductsChannelEndpointAssignment.
*/
trustProductsChannelEndpointAssignment(): TrustProductsChannelEndpointAssignmentListInstance;
/**
* Access the trustProductsEntityAssignments.
*/
trustProductsEntityAssignments(): TrustProductsEntityAssignmentsListInstance;
/**
* Access the trustProductsEvaluations.
*/
trustProductsEvaluations(): TrustProductsEvaluationsListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
policySid: string;
friendlyName: string;
status: TrustProductsStatus;
validUntil: Date;
email: string;
statusCallback: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
errors: any[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TrustProductsSolution {
}
export interface TrustProductsListInstance {
_version: V1;
_solution: TrustProductsSolution;
_uri: string;
(sid: string): TrustProductsContext;
get(sid: string): TrustProductsContext;
/**
* Create a TrustProductsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
create(params: TrustProductsListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>;
/**
* Create a TrustProductsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance with HTTP metadata
*/
createWithHttpInfo(params: TrustProductsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TrustProductsInstance>) => any): Promise<ApiResponse<TrustProductsInstance>>;
/**
* Streams TrustProductsInstance 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 { TrustProductsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TrustProductsInstance, done: (err?: Error) => void) => void): void;
each(params: TrustProductsListInstanceEachOptions, callback?: (item: TrustProductsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TrustProductsInstance 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 { TrustProductsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TrustProductsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TrustProductsListInstanceEachOptions, callback?: (item: TrustProductsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TrustProductsInstance 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: TrustProductsPage) => any): Promise<TrustProductsPage>;
/**
* Retrieve a single target page of TrustProductsInstance 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<TrustProductsPage>) => any): Promise<ApiResponse<TrustProductsPage>>;
/**
* Lists TrustProductsInstance 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 { TrustProductsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TrustProductsInstance[]) => any): Promise<TrustProductsInstance[]>;
list(params: TrustProductsListInstanceOptions, callback?: (error: Error | null, items: TrustProductsInstance[]) => any): Promise<TrustProductsInstance[]>;
/**
* Lists TrustProductsInstance 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 { TrustProductsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsInstance[]>) => any): Promise<ApiResponse<TrustProductsInstance[]>>;
listWithHttpInfo(params: TrustProductsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsInstance[]>) => any): Promise<ApiResponse<TrustProductsInstance[]>>;
/**
* Retrieve a single page of TrustProductsInstance 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 { TrustProductsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TrustProductsPage) => any): Promise<TrustProductsPage>;
page(params: TrustProductsListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsPage) => any): Promise<TrustProductsPage>;
/**
* Retrieve a single page of TrustProductsInstance 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 { TrustProductsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsPage>) => any): Promise<ApiResponse<TrustProductsPage>>;
pageWithHttpInfo(params: TrustProductsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsPage>) => any): Promise<ApiResponse<TrustProductsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TrustProductsListInstance(version: V1): TrustProductsListInstance;
export declare class TrustProductsPage extends Page<V1, TrustProductsPayload, TrustProductsResource, TrustProductsInstance> {
/**
* Initialize the TrustProductsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TrustProductsSolution);
/**
* Build an instance of TrustProductsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TrustProductsResource): TrustProductsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,518 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.TrustProductsPage = exports.TrustProductsInstance = exports.TrustProductsContextImpl = void 0;
exports.TrustProductsListInstance = TrustProductsListInstance;
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 trustProductsChannelEndpointAssignment_1 = require("./trustProducts/trustProductsChannelEndpointAssignment");
const trustProductsEntityAssignments_1 = require("./trustProducts/trustProductsEntityAssignments");
const trustProductsEvaluations_1 = require("./trustProducts/trustProductsEvaluations");
class TrustProductsContextImpl {
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 = `/TrustProducts/${sid}`;
}
get trustProductsChannelEndpointAssignment() {
this._trustProductsChannelEndpointAssignment =
this._trustProductsChannelEndpointAssignment ||
(0, trustProductsChannelEndpointAssignment_1.TrustProductsChannelEndpointAssignmentListInstance)(this._version, this._solution.sid);
return this._trustProductsChannelEndpointAssignment;
}
get trustProductsEntityAssignments() {
this._trustProductsEntityAssignments =
this._trustProductsEntityAssignments ||
(0, trustProductsEntityAssignments_1.TrustProductsEntityAssignmentsListInstance)(this._version, this._solution.sid);
return this._trustProductsEntityAssignments;
}
get trustProductsEvaluations() {
this._trustProductsEvaluations =
this._trustProductsEvaluations ||
(0, trustProductsEvaluations_1.TrustProductsEvaluationsListInstance)(this._version, this._solution.sid);
return this._trustProductsEvaluations;
}
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 TrustProductsInstance(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 TrustProductsInstance(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
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 TrustProductsInstance(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
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 TrustProductsInstance(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.TrustProductsContextImpl = TrustProductsContextImpl;
class TrustProductsInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.policySid = payload.policy_sid;
this.friendlyName = payload.friendly_name;
this.status = payload.status;
this.validUntil = deserialize.iso8601DateTime(payload.valid_until);
this.email = payload.email;
this.statusCallback = payload.status_callback;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this.errors = payload.errors;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new TrustProductsContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a TrustProductsInstance 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 TrustProductsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TrustProductsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsInstance 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 trustProductsChannelEndpointAssignment.
*/
trustProductsChannelEndpointAssignment() {
return this._proxy.trustProductsChannelEndpointAssignment;
}
/**
* Access the trustProductsEntityAssignments.
*/
trustProductsEntityAssignments() {
return this._proxy.trustProductsEntityAssignments;
}
/**
* Access the trustProductsEvaluations.
*/
trustProductsEvaluations() {
return this._proxy.trustProductsEvaluations;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
policySid: this.policySid,
friendlyName: this.friendlyName,
status: this.status,
validUntil: this.validUntil,
email: this.email,
statusCallback: this.statusCallback,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
errors: this.errors,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsInstance = TrustProductsInstance;
function TrustProductsListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TrustProductsContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/TrustProducts`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["email"] === null || params["email"] === undefined) {
throw new Error("Required parameter \"params['email']\" missing.");
}
if (params["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Email"] = params["email"];
data["PolicySid"] = params["policySid"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
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 TrustProductsInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["email"] === null || params["email"] === undefined) {
throw new Error("Required parameter \"params['email']\" missing.");
}
if (params["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Email"] = params["email"];
data["PolicySid"] = params["policySid"];
if (params["statusCallback"] !== undefined)
data["StatusCallback"] = params["statusCallback"];
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 TrustProductsInstance(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["policySid"] !== undefined)
data["PolicySid"] = params["policySid"];
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 TrustProductsPage(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 TrustProductsPage(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["status"] !== undefined)
data["Status"] = params["status"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["policySid"] !== undefined)
data["PolicySid"] = params["policySid"];
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 TrustProductsPage(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 TrustProductsPage(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 TrustProductsPage extends Page_1.default {
/**
* Initialize the TrustProductsPage
*
* @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 TrustProductsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TrustProductsInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsPage = TrustProductsPage;

View File

@@ -0,0 +1,367 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a TrustProductsChannelEndpointAssignmentInstance
*/
export interface TrustProductsChannelEndpointAssignmentListInstanceCreateOptions {
/** The type of channel endpoint. eg: phone-number */
channelEndpointType: string;
/** The SID of an channel endpoint */
channelEndpointSid: string;
}
/**
* Options to pass to each
*/
export interface TrustProductsChannelEndpointAssignmentListInstanceEachOptions {
/** The SID of an channel endpoint */
channelEndpointSid?: string;
/** comma separated list of channel endpoint sids */
channelEndpointSids?: 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: TrustProductsChannelEndpointAssignmentInstance, 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 TrustProductsChannelEndpointAssignmentListInstanceOptions {
/** The SID of an channel endpoint */
channelEndpointSid?: string;
/** comma separated list of channel endpoint sids */
channelEndpointSids?: 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 TrustProductsChannelEndpointAssignmentListInstancePageOptions {
/** The SID of an channel endpoint */
channelEndpointSid?: string;
/** comma separated list of channel endpoint sids */
channelEndpointSids?: 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 TrustProductsChannelEndpointAssignmentContext {
/**
* Remove a TrustProductsChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrustProductsChannelEndpointAssignmentInstance 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 TrustProductsChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>;
/**
* Fetch a TrustProductsChannelEndpointAssignmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TrustProductsChannelEndpointAssignmentContextSolution {
trustProductSid: string;
sid: string;
}
export declare class TrustProductsChannelEndpointAssignmentContextImpl implements TrustProductsChannelEndpointAssignmentContext {
protected _version: V1;
protected _solution: TrustProductsChannelEndpointAssignmentContextSolution;
protected _uri: string;
constructor(_version: V1, trustProductSid: 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?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TrustProductsChannelEndpointAssignmentContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TrustProductsChannelEndpointAssignmentPayload extends TwilioResponsePayload {
results: TrustProductsChannelEndpointAssignmentResource[];
}
interface TrustProductsChannelEndpointAssignmentResource {
sid: string;
trust_product_sid: string;
account_sid: string;
channel_endpoint_type: string;
channel_endpoint_sid: string;
date_created: Date;
url: string;
}
export declare class TrustProductsChannelEndpointAssignmentInstance {
protected _version: V1;
protected _solution: TrustProductsChannelEndpointAssignmentContextSolution;
protected _context?: TrustProductsChannelEndpointAssignmentContext;
constructor(_version: V1, payload: TrustProductsChannelEndpointAssignmentResource, trustProductSid: string, sid?: string);
/**
* The unique string that we created to identify the Item Assignment resource.
*/
sid: string;
/**
* The unique string that we created to identify the CustomerProfile resource.
*/
trustProductSid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
*/
accountSid: string;
/**
* The type of channel endpoint. eg: phone-number
*/
channelEndpointType: string;
/**
* The SID of an channel endpoint
*/
channelEndpointSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The absolute URL of the Identity resource.
*/
url: string;
private get _proxy();
/**
* Remove a TrustProductsChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrustProductsChannelEndpointAssignmentInstance 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 TrustProductsChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>;
/**
* Fetch a TrustProductsChannelEndpointAssignmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
trustProductSid: string;
accountSid: string;
channelEndpointType: string;
channelEndpointSid: string;
dateCreated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TrustProductsChannelEndpointAssignmentSolution {
trustProductSid: string;
}
export interface TrustProductsChannelEndpointAssignmentListInstance {
_version: V1;
_solution: TrustProductsChannelEndpointAssignmentSolution;
_uri: string;
(sid: string): TrustProductsChannelEndpointAssignmentContext;
get(sid: string): TrustProductsChannelEndpointAssignmentContext;
/**
* Create a TrustProductsChannelEndpointAssignmentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance
*/
create(params: TrustProductsChannelEndpointAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>;
/**
* Create a TrustProductsChannelEndpointAssignmentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance with HTTP metadata
*/
createWithHttpInfo(params: TrustProductsChannelEndpointAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TrustProductsChannelEndpointAssignmentInstance>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentInstance>>;
/**
* Streams TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TrustProductsChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
each(params: TrustProductsChannelEndpointAssignmentListInstanceEachOptions, callback?: (item: TrustProductsChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TrustProductsChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TrustProductsChannelEndpointAssignmentListInstanceEachOptions, callback?: (item: TrustProductsChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TrustProductsChannelEndpointAssignmentInstance 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: TrustProductsChannelEndpointAssignmentPage) => any): Promise<TrustProductsChannelEndpointAssignmentPage>;
/**
* Retrieve a single target page of TrustProductsChannelEndpointAssignmentInstance 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<TrustProductsChannelEndpointAssignmentPage>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentPage>>;
/**
* Lists TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentInstance[]) => any): Promise<TrustProductsChannelEndpointAssignmentInstance[]>;
list(params: TrustProductsChannelEndpointAssignmentListInstanceOptions, callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentInstance[]) => any): Promise<TrustProductsChannelEndpointAssignmentInstance[]>;
/**
* Lists TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsChannelEndpointAssignmentInstance[]>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentInstance[]>>;
listWithHttpInfo(params: TrustProductsChannelEndpointAssignmentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsChannelEndpointAssignmentInstance[]>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentInstance[]>>;
/**
* Retrieve a single page of TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentPage) => any): Promise<TrustProductsChannelEndpointAssignmentPage>;
page(params: TrustProductsChannelEndpointAssignmentListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentPage) => any): Promise<TrustProductsChannelEndpointAssignmentPage>;
/**
* Retrieve a single page of TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsChannelEndpointAssignmentPage>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentPage>>;
pageWithHttpInfo(params: TrustProductsChannelEndpointAssignmentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsChannelEndpointAssignmentPage>) => any): Promise<ApiResponse<TrustProductsChannelEndpointAssignmentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TrustProductsChannelEndpointAssignmentListInstance(version: V1, trustProductSid: string): TrustProductsChannelEndpointAssignmentListInstance;
export declare class TrustProductsChannelEndpointAssignmentPage extends Page<V1, TrustProductsChannelEndpointAssignmentPayload, TrustProductsChannelEndpointAssignmentResource, TrustProductsChannelEndpointAssignmentInstance> {
/**
* Initialize the TrustProductsChannelEndpointAssignmentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TrustProductsChannelEndpointAssignmentSolution);
/**
* Build an instance of TrustProductsChannelEndpointAssignmentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TrustProductsChannelEndpointAssignmentResource): TrustProductsChannelEndpointAssignmentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,385 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.TrustProductsChannelEndpointAssignmentPage = exports.TrustProductsChannelEndpointAssignmentInstance = exports.TrustProductsChannelEndpointAssignmentContextImpl = void 0;
exports.TrustProductsChannelEndpointAssignmentListInstance = TrustProductsChannelEndpointAssignmentListInstance;
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 TrustProductsChannelEndpointAssignmentContextImpl {
constructor(_version, trustProductSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trustProductSid)) {
throw new Error("Parameter 'trustProductSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trustProductSid, sid };
this._uri = `/TrustProducts/${trustProductSid}/ChannelEndpointAssignments/${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 TrustProductsChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.trustProductSid, 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 TrustProductsChannelEndpointAssignmentInstance(operationVersion, response.body, instance._solution.trustProductSid, 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.TrustProductsChannelEndpointAssignmentContextImpl = TrustProductsChannelEndpointAssignmentContextImpl;
class TrustProductsChannelEndpointAssignmentInstance {
constructor(_version, payload, trustProductSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.trustProductSid = payload.trust_product_sid;
this.accountSid = payload.account_sid;
this.channelEndpointType = payload.channel_endpoint_type;
this.channelEndpointSid = payload.channel_endpoint_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.url = payload.url;
this._solution = { trustProductSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new TrustProductsChannelEndpointAssignmentContextImpl(this._version, this._solution.trustProductSid, this._solution.sid);
return this._context;
}
/**
* Remove a TrustProductsChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a TrustProductsChannelEndpointAssignmentInstance 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 TrustProductsChannelEndpointAssignmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TrustProductsChannelEndpointAssignmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
trustProductSid: this.trustProductSid,
accountSid: this.accountSid,
channelEndpointType: this.channelEndpointType,
channelEndpointSid: this.channelEndpointSid,
dateCreated: this.dateCreated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsChannelEndpointAssignmentInstance = TrustProductsChannelEndpointAssignmentInstance;
function TrustProductsChannelEndpointAssignmentListInstance(version, trustProductSid) {
if (!(0, utility_1.isValidPathParam)(trustProductSid)) {
throw new Error("Parameter 'trustProductSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TrustProductsChannelEndpointAssignmentContextImpl(version, trustProductSid, sid);
};
instance._version = version;
instance._solution = { trustProductSid };
instance._uri = `/TrustProducts/${trustProductSid}/ChannelEndpointAssignments`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["channelEndpointType"] === null ||
params["channelEndpointType"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointType']\" missing.");
}
if (params["channelEndpointSid"] === null ||
params["channelEndpointSid"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointSid']\" missing.");
}
let data = {};
data["ChannelEndpointType"] = params["channelEndpointType"];
data["ChannelEndpointSid"] = params["channelEndpointSid"];
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 TrustProductsChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.trustProductSid));
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["channelEndpointType"] === null ||
params["channelEndpointType"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointType']\" missing.");
}
if (params["channelEndpointSid"] === null ||
params["channelEndpointSid"] === undefined) {
throw new Error("Required parameter \"params['channelEndpointSid']\" missing.");
}
let data = {};
data["ChannelEndpointType"] = params["channelEndpointType"];
data["ChannelEndpointSid"] = params["channelEndpointSid"];
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 TrustProductsChannelEndpointAssignmentInstance(operationVersion, response.body, instance._solution.trustProductSid),
}));
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["channelEndpointSid"] !== undefined)
data["ChannelEndpointSid"] = params["channelEndpointSid"];
if (params["channelEndpointSids"] !== undefined)
data["ChannelEndpointSids"] = params["channelEndpointSids"];
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 TrustProductsChannelEndpointAssignmentPage(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 TrustProductsChannelEndpointAssignmentPage(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["channelEndpointSid"] !== undefined)
data["ChannelEndpointSid"] = params["channelEndpointSid"];
if (params["channelEndpointSids"] !== undefined)
data["ChannelEndpointSids"] = params["channelEndpointSids"];
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 TrustProductsChannelEndpointAssignmentPage(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 TrustProductsChannelEndpointAssignmentPage(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 TrustProductsChannelEndpointAssignmentPage extends Page_1.default {
/**
* Initialize the TrustProductsChannelEndpointAssignmentPage
*
* @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 TrustProductsChannelEndpointAssignmentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TrustProductsChannelEndpointAssignmentInstance(this._version, payload, this._solution.trustProductSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsChannelEndpointAssignmentPage = TrustProductsChannelEndpointAssignmentPage;

View File

@@ -0,0 +1,353 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a TrustProductsEntityAssignmentsInstance
*/
export interface TrustProductsEntityAssignmentsListInstanceCreateOptions {
/** The SID of an object bag that holds information of the different items. */
objectSid: string;
}
/**
* Options to pass to each
*/
export interface TrustProductsEntityAssignmentsListInstanceEachOptions {
/** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */
objectType?: 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: TrustProductsEntityAssignmentsInstance, 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 TrustProductsEntityAssignmentsListInstanceOptions {
/** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */
objectType?: 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 TrustProductsEntityAssignmentsListInstancePageOptions {
/** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */
objectType?: 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 TrustProductsEntityAssignmentsContext {
/**
* Remove a TrustProductsEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>;
/**
* Fetch a TrustProductsEntityAssignmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsEntityAssignmentsInstance>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TrustProductsEntityAssignmentsContextSolution {
trustProductSid: string;
sid: string;
}
export declare class TrustProductsEntityAssignmentsContextImpl implements TrustProductsEntityAssignmentsContext {
protected _version: V1;
protected _solution: TrustProductsEntityAssignmentsContextSolution;
protected _uri: string;
constructor(_version: V1, trustProductSid: 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?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsEntityAssignmentsInstance>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TrustProductsEntityAssignmentsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TrustProductsEntityAssignmentsPayload extends TwilioResponsePayload {
results: TrustProductsEntityAssignmentsResource[];
}
interface TrustProductsEntityAssignmentsResource {
sid: string;
trust_product_sid: string;
account_sid: string;
object_sid: string;
date_created: Date;
url: string;
}
export declare class TrustProductsEntityAssignmentsInstance {
protected _version: V1;
protected _solution: TrustProductsEntityAssignmentsContextSolution;
protected _context?: TrustProductsEntityAssignmentsContext;
constructor(_version: V1, payload: TrustProductsEntityAssignmentsResource, trustProductSid: string, sid?: string);
/**
* The unique string that we created to identify the Item Assignment resource.
*/
sid: string;
/**
* The unique string that we created to identify the TrustProduct resource.
*/
trustProductSid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
*/
accountSid: string;
/**
* The SID of an object bag that holds information of the different items.
*/
objectSid: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The absolute URL of the Identity resource.
*/
url: string;
private get _proxy();
/**
* Remove a TrustProductsEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>;
/**
* Fetch a TrustProductsEntityAssignmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsEntityAssignmentsInstance>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
trustProductSid: string;
accountSid: string;
objectSid: string;
dateCreated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TrustProductsEntityAssignmentsSolution {
trustProductSid: string;
}
export interface TrustProductsEntityAssignmentsListInstance {
_version: V1;
_solution: TrustProductsEntityAssignmentsSolution;
_uri: string;
(sid: string): TrustProductsEntityAssignmentsContext;
get(sid: string): TrustProductsEntityAssignmentsContext;
/**
* Create a TrustProductsEntityAssignmentsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance
*/
create(params: TrustProductsEntityAssignmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>;
/**
* Create a TrustProductsEntityAssignmentsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance with HTTP metadata
*/
createWithHttpInfo(params: TrustProductsEntityAssignmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TrustProductsEntityAssignmentsInstance>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsInstance>>;
/**
* Streams TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TrustProductsEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
each(params: TrustProductsEntityAssignmentsListInstanceEachOptions, callback?: (item: TrustProductsEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TrustProductsEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TrustProductsEntityAssignmentsListInstanceEachOptions, callback?: (item: TrustProductsEntityAssignmentsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TrustProductsEntityAssignmentsInstance 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: TrustProductsEntityAssignmentsPage) => any): Promise<TrustProductsEntityAssignmentsPage>;
/**
* Retrieve a single target page of TrustProductsEntityAssignmentsInstance 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<TrustProductsEntityAssignmentsPage>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsPage>>;
/**
* Lists TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TrustProductsEntityAssignmentsInstance[]) => any): Promise<TrustProductsEntityAssignmentsInstance[]>;
list(params: TrustProductsEntityAssignmentsListInstanceOptions, callback?: (error: Error | null, items: TrustProductsEntityAssignmentsInstance[]) => any): Promise<TrustProductsEntityAssignmentsInstance[]>;
/**
* Lists TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsEntityAssignmentsInstance[]>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsInstance[]>>;
listWithHttpInfo(params: TrustProductsEntityAssignmentsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsEntityAssignmentsInstance[]>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsInstance[]>>;
/**
* Retrieve a single page of TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TrustProductsEntityAssignmentsPage) => any): Promise<TrustProductsEntityAssignmentsPage>;
page(params: TrustProductsEntityAssignmentsListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsEntityAssignmentsPage) => any): Promise<TrustProductsEntityAssignmentsPage>;
/**
* Retrieve a single page of TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsEntityAssignmentsPage>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsPage>>;
pageWithHttpInfo(params: TrustProductsEntityAssignmentsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsEntityAssignmentsPage>) => any): Promise<ApiResponse<TrustProductsEntityAssignmentsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TrustProductsEntityAssignmentsListInstance(version: V1, trustProductSid: string): TrustProductsEntityAssignmentsListInstance;
export declare class TrustProductsEntityAssignmentsPage extends Page<V1, TrustProductsEntityAssignmentsPayload, TrustProductsEntityAssignmentsResource, TrustProductsEntityAssignmentsInstance> {
/**
* Initialize the TrustProductsEntityAssignmentsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TrustProductsEntityAssignmentsSolution);
/**
* Build an instance of TrustProductsEntityAssignmentsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TrustProductsEntityAssignmentsResource): TrustProductsEntityAssignmentsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,367 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.TrustProductsEntityAssignmentsPage = exports.TrustProductsEntityAssignmentsInstance = exports.TrustProductsEntityAssignmentsContextImpl = void 0;
exports.TrustProductsEntityAssignmentsListInstance = TrustProductsEntityAssignmentsListInstance;
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 TrustProductsEntityAssignmentsContextImpl {
constructor(_version, trustProductSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trustProductSid)) {
throw new Error("Parameter 'trustProductSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trustProductSid, sid };
this._uri = `/TrustProducts/${trustProductSid}/EntityAssignments/${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 TrustProductsEntityAssignmentsInstance(operationVersion, payload, instance._solution.trustProductSid, 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 TrustProductsEntityAssignmentsInstance(operationVersion, response.body, instance._solution.trustProductSid, 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.TrustProductsEntityAssignmentsContextImpl = TrustProductsEntityAssignmentsContextImpl;
class TrustProductsEntityAssignmentsInstance {
constructor(_version, payload, trustProductSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.trustProductSid = payload.trust_product_sid;
this.accountSid = payload.account_sid;
this.objectSid = payload.object_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.url = payload.url;
this._solution = { trustProductSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new TrustProductsEntityAssignmentsContextImpl(this._version, this._solution.trustProductSid, this._solution.sid);
return this._context;
}
/**
* Remove a TrustProductsEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TrustProductsEntityAssignmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEntityAssignmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
trustProductSid: this.trustProductSid,
accountSid: this.accountSid,
objectSid: this.objectSid,
dateCreated: this.dateCreated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsEntityAssignmentsInstance = TrustProductsEntityAssignmentsInstance;
function TrustProductsEntityAssignmentsListInstance(version, trustProductSid) {
if (!(0, utility_1.isValidPathParam)(trustProductSid)) {
throw new Error("Parameter 'trustProductSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TrustProductsEntityAssignmentsContextImpl(version, trustProductSid, sid);
};
instance._version = version;
instance._solution = { trustProductSid };
instance._uri = `/TrustProducts/${trustProductSid}/EntityAssignments`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["objectSid"] === null || params["objectSid"] === undefined) {
throw new Error("Required parameter \"params['objectSid']\" missing.");
}
let data = {};
data["ObjectSid"] = params["objectSid"];
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 TrustProductsEntityAssignmentsInstance(operationVersion, payload, instance._solution.trustProductSid));
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["objectSid"] === null || params["objectSid"] === undefined) {
throw new Error("Required parameter \"params['objectSid']\" missing.");
}
let data = {};
data["ObjectSid"] = params["objectSid"];
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 TrustProductsEntityAssignmentsInstance(operationVersion, response.body, instance._solution.trustProductSid),
}));
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["objectType"] !== undefined)
data["ObjectType"] = params["objectType"];
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 TrustProductsEntityAssignmentsPage(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 TrustProductsEntityAssignmentsPage(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["objectType"] !== undefined)
data["ObjectType"] = params["objectType"];
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 TrustProductsEntityAssignmentsPage(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 TrustProductsEntityAssignmentsPage(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 TrustProductsEntityAssignmentsPage extends Page_1.default {
/**
* Initialize the TrustProductsEntityAssignmentsPage
*
* @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 TrustProductsEntityAssignmentsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TrustProductsEntityAssignmentsInstance(this._version, payload, this._solution.trustProductSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsEntityAssignmentsPage = TrustProductsEntityAssignmentsPage;

View File

@@ -0,0 +1,320 @@
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 compliance status of the Evaluation resource.
*/
export type TrustProductsEvaluationsStatus = "compliant" | "noncompliant";
/**
* Options to pass to create a TrustProductsEvaluationsInstance
*/
export interface TrustProductsEvaluationsListInstanceCreateOptions {
/** The unique string of a policy that is associated to the customer_profile resource. */
policySid: string;
}
/**
* Options to pass to each
*/
export interface TrustProductsEvaluationsListInstanceEachOptions {
/** 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: TrustProductsEvaluationsInstance, 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 TrustProductsEvaluationsListInstanceOptions {
/** 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 TrustProductsEvaluationsListInstancePageOptions {
/** 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 TrustProductsEvaluationsContext {
/**
* Fetch a TrustProductsEvaluationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>;
/**
* Fetch a TrustProductsEvaluationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsEvaluationsInstance>) => any): Promise<ApiResponse<TrustProductsEvaluationsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TrustProductsEvaluationsContextSolution {
trustProductSid: string;
sid: string;
}
export declare class TrustProductsEvaluationsContextImpl implements TrustProductsEvaluationsContext {
protected _version: V1;
protected _solution: TrustProductsEvaluationsContextSolution;
protected _uri: string;
constructor(_version: V1, trustProductSid: string, sid: string);
fetch(callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsEvaluationsInstance>) => any): Promise<ApiResponse<TrustProductsEvaluationsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TrustProductsEvaluationsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TrustProductsEvaluationsPayload extends TwilioResponsePayload {
results: TrustProductsEvaluationsResource[];
}
interface TrustProductsEvaluationsResource {
sid: string;
account_sid: string;
policy_sid: string;
trust_product_sid: string;
status: TrustProductsEvaluationsStatus;
results: Array<any>;
date_created: Date;
url: string;
}
export declare class TrustProductsEvaluationsInstance {
protected _version: V1;
protected _solution: TrustProductsEvaluationsContextSolution;
protected _context?: TrustProductsEvaluationsContext;
constructor(_version: V1, payload: TrustProductsEvaluationsResource, trustProductSid: string, sid?: string);
/**
* The unique string that identifies the Evaluation resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the trust_product resource.
*/
accountSid: string;
/**
* The unique string of a policy that is associated to the trust_product resource.
*/
policySid: string;
/**
* The unique string that we created to identify the trust_product resource.
*/
trustProductSid: string;
status: TrustProductsEvaluationsStatus;
/**
* The results of the Evaluation which includes the valid and invalid attributes.
*/
results: Array<any>;
dateCreated: Date;
url: string;
private get _proxy();
/**
* Fetch a TrustProductsEvaluationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance
*/
fetch(callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>;
/**
* Fetch a TrustProductsEvaluationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrustProductsEvaluationsInstance>) => any): Promise<ApiResponse<TrustProductsEvaluationsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
policySid: string;
trustProductSid: string;
status: TrustProductsEvaluationsStatus;
results: any[];
dateCreated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TrustProductsEvaluationsSolution {
trustProductSid: string;
}
export interface TrustProductsEvaluationsListInstance {
_version: V1;
_solution: TrustProductsEvaluationsSolution;
_uri: string;
(sid: string): TrustProductsEvaluationsContext;
get(sid: string): TrustProductsEvaluationsContext;
/**
* Create a TrustProductsEvaluationsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance
*/
create(params: TrustProductsEvaluationsListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>;
/**
* Create a TrustProductsEvaluationsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance with HTTP metadata
*/
createWithHttpInfo(params: TrustProductsEvaluationsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TrustProductsEvaluationsInstance>) => any): Promise<ApiResponse<TrustProductsEvaluationsInstance>>;
/**
* Streams TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TrustProductsEvaluationsInstance, done: (err?: Error) => void) => void): void;
each(params: TrustProductsEvaluationsListInstanceEachOptions, callback?: (item: TrustProductsEvaluationsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TrustProductsEvaluationsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TrustProductsEvaluationsListInstanceEachOptions, callback?: (item: TrustProductsEvaluationsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TrustProductsEvaluationsInstance 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: TrustProductsEvaluationsPage) => any): Promise<TrustProductsEvaluationsPage>;
/**
* Retrieve a single target page of TrustProductsEvaluationsInstance 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<TrustProductsEvaluationsPage>) => any): Promise<ApiResponse<TrustProductsEvaluationsPage>>;
/**
* Lists TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TrustProductsEvaluationsInstance[]) => any): Promise<TrustProductsEvaluationsInstance[]>;
list(params: TrustProductsEvaluationsListInstanceOptions, callback?: (error: Error | null, items: TrustProductsEvaluationsInstance[]) => any): Promise<TrustProductsEvaluationsInstance[]>;
/**
* Lists TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsEvaluationsInstance[]>) => any): Promise<ApiResponse<TrustProductsEvaluationsInstance[]>>;
listWithHttpInfo(params: TrustProductsEvaluationsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsEvaluationsInstance[]>) => any): Promise<ApiResponse<TrustProductsEvaluationsInstance[]>>;
/**
* Retrieve a single page of TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TrustProductsEvaluationsPage) => any): Promise<TrustProductsEvaluationsPage>;
page(params: TrustProductsEvaluationsListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsEvaluationsPage) => any): Promise<TrustProductsEvaluationsPage>;
/**
* Retrieve a single page of TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrustProductsEvaluationsPage>) => any): Promise<ApiResponse<TrustProductsEvaluationsPage>>;
pageWithHttpInfo(params: TrustProductsEvaluationsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TrustProductsEvaluationsPage>) => any): Promise<ApiResponse<TrustProductsEvaluationsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TrustProductsEvaluationsListInstance(version: V1, trustProductSid: string): TrustProductsEvaluationsListInstance;
export declare class TrustProductsEvaluationsPage extends Page<V1, TrustProductsEvaluationsPayload, TrustProductsEvaluationsResource, TrustProductsEvaluationsInstance> {
/**
* Initialize the TrustProductsEvaluationsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TrustProductsEvaluationsSolution);
/**
* Build an instance of TrustProductsEvaluationsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TrustProductsEvaluationsResource): TrustProductsEvaluationsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,322 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trusthub
* 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.TrustProductsEvaluationsPage = exports.TrustProductsEvaluationsInstance = exports.TrustProductsEvaluationsContextImpl = void 0;
exports.TrustProductsEvaluationsListInstance = TrustProductsEvaluationsListInstance;
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 TrustProductsEvaluationsContextImpl {
constructor(_version, trustProductSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trustProductSid)) {
throw new Error("Parameter 'trustProductSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trustProductSid, sid };
this._uri = `/TrustProducts/${trustProductSid}/Evaluations/${sid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new TrustProductsEvaluationsInstance(operationVersion, payload, instance._solution.trustProductSid, 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 TrustProductsEvaluationsInstance(operationVersion, response.body, instance._solution.trustProductSid, 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.TrustProductsEvaluationsContextImpl = TrustProductsEvaluationsContextImpl;
class TrustProductsEvaluationsInstance {
constructor(_version, payload, trustProductSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.policySid = payload.policy_sid;
this.trustProductSid = payload.trust_product_sid;
this.status = payload.status;
this.results = payload.results;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.url = payload.url;
this._solution = { trustProductSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new TrustProductsEvaluationsContextImpl(this._version, this._solution.trustProductSid, this._solution.sid);
return this._context;
}
/**
* Fetch a TrustProductsEvaluationsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TrustProductsEvaluationsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrustProductsEvaluationsInstance 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,
policySid: this.policySid,
trustProductSid: this.trustProductSid,
status: this.status,
results: this.results,
dateCreated: this.dateCreated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsEvaluationsInstance = TrustProductsEvaluationsInstance;
function TrustProductsEvaluationsListInstance(version, trustProductSid) {
if (!(0, utility_1.isValidPathParam)(trustProductSid)) {
throw new Error("Parameter 'trustProductSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TrustProductsEvaluationsContextImpl(version, trustProductSid, sid);
};
instance._version = version;
instance._solution = { trustProductSid };
instance._uri = `/TrustProducts/${trustProductSid}/Evaluations`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["PolicySid"] = params["policySid"];
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 TrustProductsEvaluationsInstance(operationVersion, payload, instance._solution.trustProductSid));
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["policySid"] === null || params["policySid"] === undefined) {
throw new Error("Required parameter \"params['policySid']\" missing.");
}
let data = {};
data["PolicySid"] = params["policySid"];
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 TrustProductsEvaluationsInstance(operationVersion, response.body, instance._solution.trustProductSid),
}));
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 TrustProductsEvaluationsPage(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 TrustProductsEvaluationsPage(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 TrustProductsEvaluationsPage(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 TrustProductsEvaluationsPage(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 TrustProductsEvaluationsPage extends Page_1.default {
/**
* Initialize the TrustProductsEvaluationsPage
*
* @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 TrustProductsEvaluationsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TrustProductsEvaluationsInstance(this._version, payload, this._solution.trustProductSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrustProductsEvaluationsPage = TrustProductsEvaluationsPage;