From d2476bb300ba7987ecef7d19e646a73050e826ba Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 7 Nov 2023 13:07:42 +0530 Subject: [PATCH] chore: executed prettier --- src/base/RequestClient.ts | 7 +- src/rest/PreviewMessaging.ts | 20 +++--- src/rest/previewMessaging/V1.ts | 1 - src/rest/previewMessaging/v1/broadcast.ts | 86 ++++++++++++----------- src/rest/previewMessaging/v1/message.ts | 80 ++++++++++----------- 5 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index f48b00b13..263c44324 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -191,10 +191,11 @@ class RequestClient { }; if (opts.data && options.headers) { - if(options.headers["Content-Type"] === "application/x-www-form-urlencoded") { + if ( + options.headers["Content-Type"] === "application/x-www-form-urlencoded" + ) { options.data = qs.stringify(opts.data, { arrayFormat: "repeat" }); - } - else if(options.headers["Content-Type"] === "application/json") { + } else if (options.headers["Content-Type"] === "application/json") { options.data = opts.data; } } diff --git a/src/rest/PreviewMessaging.ts b/src/rest/PreviewMessaging.ts index 6f26f3841..dc598c3a7 100644 --- a/src/rest/PreviewMessaging.ts +++ b/src/rest/PreviewMessaging.ts @@ -1,15 +1,13 @@ import PreviewMessagingBase from "./PreviewMessagingBase"; -import {MessageListInstance} from "./previewMessaging/v1/message"; +import { MessageListInstance } from "./previewMessaging/v1/message"; class PreviewMessaging extends PreviewMessagingBase { - /** - * @deprecated - Use v1.messages; instead - */ - get messages(): MessageListInstance { - console.warn( - "messages is deprecated. Use v1.messages; instead." - ); - return this.v1.messages; - } + /** + * @deprecated - Use v1.messages; instead + */ + get messages(): MessageListInstance { + console.warn("messages is deprecated. Use v1.messages; instead."); + return this.v1.messages; + } } -export = PreviewMessaging +export = PreviewMessaging; diff --git a/src/rest/previewMessaging/V1.ts b/src/rest/previewMessaging/V1.ts index b3a0f5a57..e30d2a40c 100644 --- a/src/rest/previewMessaging/V1.ts +++ b/src/rest/previewMessaging/V1.ts @@ -43,5 +43,4 @@ export default class V1 extends Version { this._messages = this._messages || MessageListInstance(this); return this._messages; } - } diff --git a/src/rest/previewMessaging/v1/broadcast.ts b/src/rest/previewMessaging/v1/broadcast.ts index 71849b6b0..099f61389 100644 --- a/src/rest/previewMessaging/v1/broadcast.ts +++ b/src/rest/previewMessaging/v1/broadcast.ts @@ -12,14 +12,12 @@ * 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"; - /** * Details on the statuses of messages sent to recipients */ @@ -38,27 +36,21 @@ export class MessagingV1BroadcastExecutionDetails { "totalErrors"?: number; } - - /** * Options to pass to create a BroadcastInstance */ export interface BroadcastListInstanceCreateOptions { /** Idempotency key provided by the client */ - "xTwilioRequestKey"?: string; + xTwilioRequestKey?: string; } - -export interface BroadcastSolution { -} +export interface BroadcastSolution {} export interface BroadcastListInstance { _version: V1; _solution: BroadcastSolution; _uri: string; - - /** * Create a BroadcastInstance * @@ -66,7 +58,9 @@ export interface BroadcastListInstance { * * @returns Resolves to processed BroadcastInstance */ - create(callback?: (error: Error | null, item?: BroadcastInstance) => any): Promise; + create( + callback?: (error: Error | null, item?: BroadcastInstance) => any + ): Promise; /** * Create a BroadcastInstance * @@ -75,8 +69,10 @@ export interface BroadcastListInstance { * * @returns Resolves to processed BroadcastInstance */ - create(params: BroadcastListInstanceCreateOptions, callback?: (error: Error | null, item?: BroadcastInstance) => any): Promise; - + create( + params: BroadcastListInstanceCreateOptions, + callback?: (error: Error | null, item?: BroadcastInstance) => any + ): Promise; /** * Provide a user-friendly representation @@ -89,10 +85,15 @@ export function BroadcastListInstance(version: V1): BroadcastListInstance { const instance = {} as BroadcastListInstance; instance._version = version; - instance._solution = { }; + instance._solution = {}; instance._uri = `/Broadcasts`; - instance.create = function create(params?: BroadcastListInstanceCreateOptions | ((error: Error | null, items: BroadcastInstance) => any), callback?: (error: Error | null, items: BroadcastInstance) => any): Promise { + instance.create = function create( + params?: + | BroadcastListInstanceCreateOptions + | ((error: Error | null, items: BroadcastInstance) => any), + callback?: (error: Error | null, items: BroadcastInstance) => any + ): Promise { if (params instanceof Function) { callback = params; params = {}; @@ -102,32 +103,39 @@ export function BroadcastListInstance(version: V1): BroadcastListInstance { let data: any = {}; - - - - const headers: any = {}; - if (params["xTwilioRequestKey"] !== undefined) headers["X-Twilio-Request-Key"] = params["xTwilioRequestKey"]; + if (params["xTwilioRequestKey"] !== undefined) + headers["X-Twilio-Request-Key"] = params["xTwilioRequestKey"]; let operationVersion = version, - operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers }); - - operationPromise = operationPromise.then(payload => new BroadcastInstance(operationVersion, payload)); - - - operationPromise = instance._version.setPromiseCallback(operationPromise,callback); + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new BroadcastInstance(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) { + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { return inspect(instance.toJSON(), options); - } + }; return instance; } @@ -147,15 +155,13 @@ interface BroadcastResource { * Details of a Broadcast */ export class BroadcastInstance { - constructor(protected _version: V1, payload: BroadcastResource) { - this.broadcastSid = (payload.broadcast_sid); + this.broadcastSid = payload.broadcast_sid; this.createdDate = deserialize.iso8601DateTime(payload.created_date); this.updatedDate = deserialize.iso8601DateTime(payload.updated_date); - this.broadcastStatus = (payload.broadcast_status); - this.executionDetails = (payload.execution_details); - this.errorsFile = (payload.errors_file); - + this.broadcastStatus = payload.broadcast_status; + this.executionDetails = payload.execution_details; + this.errorsFile = payload.errors_file; } /** @@ -193,12 +199,10 @@ export class BroadcastInstance { broadcastStatus: this.broadcastStatus, executionDetails: this.executionDetails, errorsFile: this.errorsFile, - } + }; } [inspect.custom](_depth: any, options: InspectOptions) { return inspect(this.toJSON(), options); } } - - diff --git a/src/rest/previewMessaging/v1/message.ts b/src/rest/previewMessaging/v1/message.ts index 25031cfd3..8ba125715 100644 --- a/src/rest/previewMessaging/v1/message.ts +++ b/src/rest/previewMessaging/v1/message.ts @@ -12,14 +12,12 @@ * 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 class CreateMessagesRequest { "messages"?: Array; /** @@ -88,7 +86,6 @@ export class CreateMessagesRequest { "applicationSid"?: string; } - export class MessagingV1FailedMessageReceipt { /** * The recipient phone number @@ -104,7 +101,6 @@ export class MessagingV1FailedMessageReceipt { "errorCode"?: number; } - export class MessagingV1Message { /** * The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format for SMS/MMS or [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses) for other 3rd-party channels. @@ -117,10 +113,9 @@ export class MessagingV1Message { /** * Key-value pairs of variable names to substitution values. Refer to the [Twilio Content API Resources](https://www.twilio.com/docs/content-api/content-api-resources#send-a-message-with-preconfigured-content) for more details. */ - "contentVariables"?: { [key: string]: string; }; + "contentVariables"?: { [key: string]: string }; } - export class MessagingV1MessageReceipt { /** * The recipient phone number @@ -132,27 +127,21 @@ export class MessagingV1MessageReceipt { "sid"?: string | null; } - - /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** */ - "createMessagesRequest": CreateMessagesRequest; + createMessagesRequest: CreateMessagesRequest; } - -export interface MessageSolution { -} +export interface MessageSolution {} export interface MessageListInstance { _version: V1; _solution: MessageSolution; _uri: string; - - /** * Create a MessageInstance * @@ -161,8 +150,10 @@ export interface MessageListInstance { * * @returns Resolves to processed MessageInstance */ - create(params: CreateMessagesRequest, callback?: (error: Error | null, item?: MessageInstance) => any): Promise; - + create( + params: CreateMessagesRequest, + callback?: (error: Error | null, item?: MessageInstance) => any + ): Promise; /** * Provide a user-friendly representation @@ -175,42 +166,53 @@ export function MessageListInstance(version: V1): MessageListInstance { const instance = {} as MessageListInstance; instance._version = version; - instance._solution = { }; + instance._solution = {}; instance._uri = `/Messages`; - instance.create = function create(params: CreateMessagesRequest, callback?: (error: Error | null, items: MessageInstance) => any): Promise { + instance.create = function create( + params: CreateMessagesRequest, + callback?: (error: Error | null, items: MessageInstance) => any + ): Promise { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } let data: any = {}; - - - data = params + data = params; const headers: any = {}; - headers["Content-Type"] = "application/json" + headers["Content-Type"] = "application/json"; let operationVersion = version, - operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers }); - - operationPromise = operationPromise.then(payload => new MessageInstance(operationVersion, payload)); - - - operationPromise = instance._version.setPromiseCallback(operationPromise,callback); + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new MessageInstance(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) { + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { return inspect(instance.toJSON(), options); - } + }; return instance; } @@ -226,14 +228,12 @@ interface MessageResource { } export class MessageInstance { - constructor(protected _version: V1, payload: MessageResource) { this.totalMessageCount = deserialize.integer(payload.total_message_count); this.successCount = deserialize.integer(payload.success_count); this.errorCount = deserialize.integer(payload.error_count); - this.messageReceipts = (payload.message_receipts); - this.failedMessageReceipts = (payload.failed_message_receipts); - + this.messageReceipts = payload.message_receipts; + this.failedMessageReceipts = payload.failed_message_receipts; } /** @@ -263,12 +263,10 @@ export class MessageInstance { errorCount: this.errorCount, messageReceipts: this.messageReceipts, failedMessageReceipts: this.failedMessageReceipts, - } + }; } [inspect.custom](_depth: any, options: InspectOptions) { return inspect(this.toJSON(), options); } } - -