diff --git a/CHANGES.md b/CHANGES.md index 94e35d04d7..cdd768bb54 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,24 @@ twilio-node changelog ===================== +[2023-04-05] Version 4.10.0 +--------------------------- +**Conversations** +- Expose query parameters `start_date`, `end_date` and `state` in list operation on Conversations resource for sorting and filtering + +**Insights** +- Added answered by filter in Call Summaries + +**Lookups** +- Remove `disposable_phone_number_risk` package **(breaking change)** + +**Messaging** +- Add support for `SOLE_PROPRIETOR` brand type and `SOLE_PROPRIETOR` campaign use case. +- New Sole Proprietor Brands should be created with `SOLE_PROPRIETOR` brand type. Brand registration requests with `STARTER` brand type will be rejected. +- New Sole Proprietor Campaigns should be created with `SOLE_PROPRIETOR` campaign use case. Campaign registration requests with `STARTER` campaign use case will be rejected. +- Add Brand Registrations OTP API + + [2023-03-22] Version 4.9.0 -------------------------- **Library - Fix** diff --git a/src/rest/conversations/v1/conversation.ts b/src/rest/conversations/v1/conversation.ts index 4fa9a31f63..fc3ec7e5b0 100644 --- a/src/rest/conversations/v1/conversation.ts +++ b/src/rest/conversations/v1/conversation.ts @@ -90,6 +90,12 @@ export interface ConversationListInstanceCreateOptions { * Options to pass to each */ export interface ConversationListInstanceEachOptions { + /** Start date in ISO8601 format for sorting and filtering list of Conversations. */ + startDate?: string; + /** End date in ISO8601 format for sorting and filtering list of Conversations. */ + endDate?: string; + /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ + state?: ConversationState; /** 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 */ @@ -104,6 +110,12 @@ export interface ConversationListInstanceEachOptions { * Options to pass to list */ export interface ConversationListInstanceOptions { + /** Start date in ISO8601 format for sorting and filtering list of Conversations. */ + startDate?: string; + /** End date in ISO8601 format for sorting and filtering list of Conversations. */ + endDate?: string; + /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ + state?: ConversationState; /** 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 */ @@ -114,6 +126,12 @@ export interface ConversationListInstanceOptions { * Options to pass to page */ export interface ConversationListInstancePageOptions { + /** Start date in ISO8601 format for sorting and filtering list of Conversations. */ + startDate?: string; + /** End date in ISO8601 format for sorting and filtering list of Conversations. */ + endDate?: string; + /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ + state?: ConversationState; /** 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 */ @@ -792,6 +810,10 @@ export function ConversationListInstance( let data: any = {}; + if (params["startDate"] !== undefined) + data["StartDate"] = params["startDate"]; + if (params["endDate"] !== undefined) data["EndDate"] = params["endDate"]; + if (params["state"] !== undefined) data["State"] = params["state"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; diff --git a/src/rest/conversations/v1/service/conversation.ts b/src/rest/conversations/v1/service/conversation.ts index 95b4e4c631..a6ed5bf286 100644 --- a/src/rest/conversations/v1/service/conversation.ts +++ b/src/rest/conversations/v1/service/conversation.ts @@ -90,6 +90,12 @@ export interface ConversationListInstanceCreateOptions { * Options to pass to each */ export interface ConversationListInstanceEachOptions { + /** Start date in ISO8601 format for sorting and filtering list of Conversations. */ + startDate?: string; + /** End date in ISO8601 format for sorting and filtering list of Conversations. */ + endDate?: string; + /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ + state?: ConversationState; /** 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 */ @@ -104,6 +110,12 @@ export interface ConversationListInstanceEachOptions { * Options to pass to list */ export interface ConversationListInstanceOptions { + /** Start date in ISO8601 format for sorting and filtering list of Conversations. */ + startDate?: string; + /** End date in ISO8601 format for sorting and filtering list of Conversations. */ + endDate?: string; + /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ + state?: ConversationState; /** 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 */ @@ -114,6 +126,12 @@ export interface ConversationListInstanceOptions { * Options to pass to page */ export interface ConversationListInstancePageOptions { + /** Start date in ISO8601 format for sorting and filtering list of Conversations. */ + startDate?: string; + /** End date in ISO8601 format for sorting and filtering list of Conversations. */ + endDate?: string; + /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ + state?: ConversationState; /** 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 */ @@ -830,6 +848,10 @@ export function ConversationListInstance( let data: any = {}; + if (params["startDate"] !== undefined) + data["StartDate"] = params["startDate"]; + if (params["endDate"] !== undefined) data["EndDate"] = params["endDate"]; + if (params["state"] !== undefined) data["State"] = params["state"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; diff --git a/src/rest/insights/v1/callSummaries.ts b/src/rest/insights/v1/callSummaries.ts index b8492ca337..c8dffa0378 100644 --- a/src/rest/insights/v1/callSummaries.ts +++ b/src/rest/insights/v1/callSummaries.ts @@ -91,6 +91,8 @@ export interface CallSummariesListInstanceEachOptions { subaccount?: string; /** */ abnormalSession?: boolean; + /** */ + answeredBy?: CallSummariesAnsweredBy; /** 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 */ @@ -141,6 +143,8 @@ export interface CallSummariesListInstanceOptions { subaccount?: string; /** */ abnormalSession?: boolean; + /** */ + answeredBy?: CallSummariesAnsweredBy; /** 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 */ @@ -187,6 +191,8 @@ export interface CallSummariesListInstancePageOptions { subaccount?: string; /** */ abnormalSession?: boolean; + /** */ + answeredBy?: CallSummariesAnsweredBy; /** 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 */ @@ -339,6 +345,8 @@ export function CallSummariesListInstance( data["Subaccount"] = params["subaccount"]; if (params["abnormalSession"] !== undefined) data["AbnormalSession"] = serialize.bool(params["abnormalSession"]); + if (params["answeredBy"] !== undefined) + data["AnsweredBy"] = params["answeredBy"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; diff --git a/src/rest/lookups/v2/phoneNumber.ts b/src/rest/lookups/v2/phoneNumber.ts index e2b2f7421b..40cda572d5 100644 --- a/src/rest/lookups/v2/phoneNumber.ts +++ b/src/rest/lookups/v2/phoneNumber.ts @@ -197,7 +197,6 @@ interface PhoneNumberResource { line_type_intelligence: any; identity_match: any; sms_pumping_risk: any; - disposable_phone_number_risk: any; url: string; } @@ -223,7 +222,6 @@ export class PhoneNumberInstance { this.lineTypeIntelligence = payload.line_type_intelligence; this.identityMatch = payload.identity_match; this.smsPumpingRisk = payload.sms_pumping_risk; - this.disposablePhoneNumberRisk = payload.disposable_phone_number_risk; this.url = payload.url; this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; @@ -281,10 +279,6 @@ export class PhoneNumberInstance { * An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. */ smsPumpingRisk: any; - /** - * An object that contains information on if a mobile phone number could be a disposable or burner number. - */ - disposablePhoneNumberRisk: any; /** * The absolute URL of the resource. */ @@ -347,7 +341,6 @@ export class PhoneNumberInstance { lineTypeIntelligence: this.lineTypeIntelligence, identityMatch: this.identityMatch, smsPumpingRisk: this.smsPumpingRisk, - disposablePhoneNumberRisk: this.disposablePhoneNumberRisk, url: this.url, }; } diff --git a/src/rest/messaging/v1/brandRegistration.ts b/src/rest/messaging/v1/brandRegistration.ts index ace80ecfa8..1fd373c5d4 100644 --- a/src/rest/messaging/v1/brandRegistration.ts +++ b/src/rest/messaging/v1/brandRegistration.ts @@ -19,6 +19,7 @@ import V1 from "../V1"; const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; +import { BrandRegistrationOtpListInstance } from "./brandRegistration/brandRegistrationOtp"; import { BrandVettingListInstance } from "./brandRegistration/brandVetting"; export type BrandRegistrationBrandFeedback = @@ -49,7 +50,7 @@ export interface BrandRegistrationListInstanceCreateOptions { customerProfileBundleSid: string; /** A2P Messaging Profile Bundle Sid. */ a2PProfileBundleSid: string; - /** Type of brand being created. One of: \\\"STANDARD\\\", \\\"STARTER\\\". STARTER is for low volume, starter use cases. STANDARD is for all other use cases. */ + /** Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases. */ brandType?: string; /** A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. */ mock?: boolean; @@ -96,6 +97,7 @@ export interface BrandRegistrationListInstancePageOptions { } export interface BrandRegistrationContext { + brandRegistrationOtps: BrandRegistrationOtpListInstance; brandVettings: BrandVettingListInstance; /** @@ -135,6 +137,7 @@ export class BrandRegistrationContextImpl implements BrandRegistrationContext { protected _solution: BrandRegistrationContextSolution; protected _uri: string; + protected _brandRegistrationOtps?: BrandRegistrationOtpListInstance; protected _brandVettings?: BrandVettingListInstance; constructor(protected _version: V1, sid: string) { @@ -146,6 +149,13 @@ export class BrandRegistrationContextImpl implements BrandRegistrationContext { this._uri = `/a2p/BrandRegistrations/${sid}`; } + get brandRegistrationOtps(): BrandRegistrationOtpListInstance { + this._brandRegistrationOtps = + this._brandRegistrationOtps || + BrandRegistrationOtpListInstance(this._version, this._solution.sid); + return this._brandRegistrationOtps; + } + get brandVettings(): BrandVettingListInstance { this._brandVettings = this._brandVettings || @@ -304,7 +314,7 @@ export class BrandRegistrationInstance { */ dateUpdated: Date; /** - * Type of brand. One of: \"STANDARD\", \"STARTER\". STARTER is for the low volume, STARTER campaign use case. There can only be one STARTER campaign created per STARTER brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. + * Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. */ brandType: string; status: BrandRegistrationStatus; @@ -384,6 +394,13 @@ export class BrandRegistrationInstance { return this._proxy.update(callback); } + /** + * Access the brandRegistrationOtps. + */ + brandRegistrationOtps(): BrandRegistrationOtpListInstance { + return this._proxy.brandRegistrationOtps; + } + /** * Access the brandVettings. */ diff --git a/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts b/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts new file mode 100644 index 0000000000..8914219629 --- /dev/null +++ b/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts @@ -0,0 +1,142 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Messaging + * 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"; + +export interface BrandRegistrationOtpSolution { + brandRegistrationSid: string; +} + +export interface BrandRegistrationOtpListInstance { + _version: V1; + _solution: BrandRegistrationOtpSolution; + _uri: string; + + /** + * Create a BrandRegistrationOtpInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed BrandRegistrationOtpInstance + */ + create( + callback?: (error: Error | null, item?: BrandRegistrationOtpInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function BrandRegistrationOtpListInstance( + version: V1, + brandRegistrationSid: string +): BrandRegistrationOtpListInstance { + if (!isValidPathParam(brandRegistrationSid)) { + throw new Error("Parameter 'brandRegistrationSid' is not valid."); + } + + const instance = {} as BrandRegistrationOtpListInstance; + + instance._version = version; + instance._solution = { brandRegistrationSid }; + instance._uri = `/a2p/BrandRegistrations/${brandRegistrationSid}/SmsOtp`; + + instance.create = function create( + callback?: (error: Error | null, items: BrandRegistrationOtpInstance) => any + ): Promise { + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + }); + + operationPromise = operationPromise.then( + (payload) => + new BrandRegistrationOtpInstance( + operationVersion, + payload, + instance._solution.brandRegistrationSid + ) + ); + + 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; +} + +interface BrandRegistrationOtpPayload extends BrandRegistrationOtpResource {} + +interface BrandRegistrationOtpResource { + account_sid: string; + brand_registration_sid: string; +} + +export class BrandRegistrationOtpInstance { + constructor( + protected _version: V1, + payload: BrandRegistrationOtpResource, + brandRegistrationSid: string + ) { + this.accountSid = payload.account_sid; + this.brandRegistrationSid = payload.brand_registration_sid; + } + + /** + * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. + */ + accountSid: string; + /** + * The unique string to identify Brand Registration of Sole Proprietor Brand + */ + brandRegistrationSid: string; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accountSid: this.accountSid, + brandRegistrationSid: this.brandRegistrationSid, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/messaging/v1/service/usAppToPerson.ts b/src/rest/messaging/v1/service/usAppToPerson.ts index d7deac9b40..0582811027 100644 --- a/src/rest/messaging/v1/service/usAppToPerson.ts +++ b/src/rest/messaging/v1/service/usAppToPerson.ts @@ -295,7 +295,7 @@ export class UsAppToPersonInstance { */ messageSamples: Array; /** - * A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, STARTER...]. STARTER campaign use cases can only be created by STARTER Brands, and there can only be one STARTER campaign created per STARTER Brand. + * A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand. */ usAppToPersonUsecase: string; /**