diff --git a/CHANGES.md b/CHANGES.md index d41f4c110..e9169a632 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,15 @@ twilio-node changelog ===================== +[2023-10-05] Version 4.18.1 +--------------------------- +**Library - Fix** +- [PR #961](https://github.com/twilio/twilio-node/pull/961): update security method validatessl. Thanks to [@AsabuHere](https://github.com/AsabuHere)! + +**Lookups** +- Add test api support for Lookup v2 + + [2023-09-21] Version 4.18.0 --------------------------- **Conversations** diff --git a/src/rest/api/v2010/account/message.ts b/src/rest/api/v2010/account/message.ts index b0b240bfb..7f0794abc 100644 --- a/src/rest/api/v2010/account/message.ts +++ b/src/rest/api/v2010/account/message.ts @@ -101,8 +101,6 @@ export interface MessageListInstanceCreateOptions { sendAsMms?: boolean; /** For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template\\\'s default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. */ contentVariables?: string; - /** A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. */ - tags?: string; /** */ riskCheck?: MessageRiskCheck; /** The sender\\\'s Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service\\\'s Sender Pool) or you can provide a specific sender from your Sender Pool. */ @@ -415,7 +413,6 @@ interface MessageResource { price_unit: string; api_version: string; subresource_uris: Record; - tags: any; } export class MessageInstance { @@ -448,7 +445,6 @@ export class MessageInstance { this.priceUnit = payload.price_unit; this.apiVersion = payload.api_version; this.subresourceUris = payload.subresource_uris; - this.tags = payload.tags; this._solution = { accountSid, sid: sid || this.sid }; } @@ -527,10 +523,6 @@ export class MessageInstance { * A list of related resources identified by their URIs relative to `https://api.twilio.com` */ subresourceUris: Record; - /** - * A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. - */ - tags: any; private get _proxy(): MessageContext { this._context = @@ -640,7 +632,6 @@ export class MessageInstance { priceUnit: this.priceUnit, apiVersion: this.apiVersion, subresourceUris: this.subresourceUris, - tags: this.tags, }; } @@ -816,7 +807,6 @@ export function MessageListInstance( data["SendAsMms"] = serialize.bool(params["sendAsMms"]); if (params["contentVariables"] !== undefined) data["ContentVariables"] = params["contentVariables"]; - if (params["tags"] !== undefined) data["Tags"] = params["tags"]; if (params["riskCheck"] !== undefined) data["RiskCheck"] = params["riskCheck"]; if (params["from"] !== undefined) data["From"] = params["from"]; diff --git a/src/rest/trusthub/V1.ts b/src/rest/trusthub/V1.ts index 4a8f9d51f..19fdb9379 100644 --- a/src/rest/trusthub/V1.ts +++ b/src/rest/trusthub/V1.ts @@ -14,6 +14,7 @@ import TrusthubBase from "../TrusthubBase"; import Version from "../../base/Version"; +import { ComplianceInquiriesListInstance } from "./v1/complianceInquiries"; import { CustomerProfilesListInstance } from "./v1/customerProfiles"; import { EndUserListInstance } from "./v1/endUser"; import { EndUserTypeListInstance } from "./v1/endUserType"; @@ -32,6 +33,8 @@ export default class V1 extends Version { super(domain, "v1"); } + /** complianceInquiries - { Twilio.Trusthub.V1.ComplianceInquiriesListInstance } resource */ + protected _complianceInquiries?: ComplianceInquiriesListInstance; /** customerProfiles - { Twilio.Trusthub.V1.CustomerProfilesListInstance } resource */ protected _customerProfiles?: CustomerProfilesListInstance; /** endUsers - { Twilio.Trusthub.V1.EndUserListInstance } resource */ @@ -47,6 +50,13 @@ export default class V1 extends Version { /** trustProducts - { Twilio.Trusthub.V1.TrustProductsListInstance } resource */ protected _trustProducts?: TrustProductsListInstance; + /** Getter for complianceInquiries resource */ + get complianceInquiries(): ComplianceInquiriesListInstance { + this._complianceInquiries = + this._complianceInquiries || ComplianceInquiriesListInstance(this); + return this._complianceInquiries; + } + /** Getter for customerProfiles resource */ get customerProfiles(): CustomerProfilesListInstance { this._customerProfiles = diff --git a/src/rest/trusthub/v1/complianceInquiries.ts b/src/rest/trusthub/v1/complianceInquiries.ts new file mode 100644 index 000000000..1b72e63ce --- /dev/null +++ b/src/rest/trusthub/v1/complianceInquiries.ts @@ -0,0 +1,331 @@ +/* + * 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. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +/** + * 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; +} + +/** + * Options to pass to create a ComplianceInquiriesInstance + */ +export interface ComplianceInquiriesListInstanceCreateOptions { + /** 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; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface ComplianceInquiriesContextSolution { + customerId: string; +} + +export class ComplianceInquiriesContextImpl + implements ComplianceInquiriesContext +{ + protected _solution: ComplianceInquiriesContextSolution; + protected _uri: string; + + constructor(protected _version: V1, customerId: string) { + if (!isValidPathParam(customerId)) { + throw new Error("Parameter 'customerId' is not valid."); + } + + this._solution = { customerId }; + this._uri = `/ComplianceInquiries/Customers/${customerId}/Initialize`; + } + + update( + params: ComplianceInquiriesContextUpdateOptions, + callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any + ): Promise { + 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: any = {}; + + data["PrimaryProfileSid"] = params["primaryProfileSid"]; + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + + 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; + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return this._solution; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +interface ComplianceInquiriesPayload extends ComplianceInquiriesResource {} + +interface ComplianceInquiriesResource { + inquiry_id: string; + inquiry_session_token: string; + customer_id: string; + url: string; +} + +export class ComplianceInquiriesInstance { + protected _solution: ComplianceInquiriesContextSolution; + protected _context?: ComplianceInquiriesContext; + + constructor( + protected _version: V1, + payload: ComplianceInquiriesResource, + customerId?: string + ) { + 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 }; + } + + /** + * 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(): ComplianceInquiriesContext { + this._context = + this._context || + new ComplianceInquiriesContextImpl( + this._version, + this._solution.customerId + ); + return this._context; + } + + /** + * 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; + + update( + params?: any, + callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any + ): Promise { + return this._proxy.update(params, callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + inquiryId: this.inquiryId, + inquirySessionToken: this.inquirySessionToken, + customerId: this.customerId, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface ComplianceInquiriesSolution {} + +export interface ComplianceInquiriesListInstance { + _version: V1; + _solution: ComplianceInquiriesSolution; + _uri: string; + + (customerId: string): ComplianceInquiriesContext; + get(customerId: string): ComplianceInquiriesContext; + + /** + * 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; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function ComplianceInquiriesListInstance( + version: V1 +): ComplianceInquiriesListInstance { + const instance = ((customerId) => + instance.get(customerId)) as ComplianceInquiriesListInstance; + + instance.get = function get(customerId): ComplianceInquiriesContext { + return new ComplianceInquiriesContextImpl(version, customerId); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = `/ComplianceInquiries/Customers/Initialize`; + + instance.create = function create( + params: ComplianceInquiriesListInstanceCreateOptions, + callback?: (error: Error | null, items: ComplianceInquiriesInstance) => any + ): Promise { + 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: any = {}; + + data["PrimaryProfileSid"] = params["primaryProfileSid"]; + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + + 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.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +}