Skip to content

Commit

Permalink
chore: executed prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Nov 7, 2023
1 parent 0692802 commit d2476bb
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 97 deletions.
7 changes: 4 additions & 3 deletions src/base/RequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
20 changes: 9 additions & 11 deletions src/rest/PreviewMessaging.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 0 additions & 1 deletion src/rest/previewMessaging/V1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ export default class V1 extends Version {
this._messages = this._messages || MessageListInstance(this);
return this._messages;
}

}
86 changes: 45 additions & 41 deletions src/rest/previewMessaging/v1/broadcast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -38,35 +36,31 @@ 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
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BroadcastInstance
*/
create(callback?: (error: Error | null, item?: BroadcastInstance) => any): Promise<BroadcastInstance>;
create(
callback?: (error: Error | null, item?: BroadcastInstance) => any
): Promise<BroadcastInstance>;
/**
* Create a BroadcastInstance
*
Expand All @@ -75,8 +69,10 @@ export interface BroadcastListInstance {
*
* @returns Resolves to processed BroadcastInstance
*/
create(params: BroadcastListInstanceCreateOptions, callback?: (error: Error | null, item?: BroadcastInstance) => any): Promise<BroadcastInstance>;

create(
params: BroadcastListInstanceCreateOptions,
callback?: (error: Error | null, item?: BroadcastInstance) => any
): Promise<BroadcastInstance>;

/**
* Provide a user-friendly representation
Expand All @@ -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<BroadcastInstance> {
instance.create = function create(
params?:
| BroadcastListInstanceCreateOptions
| ((error: Error | null, items: BroadcastInstance) => any),
callback?: (error: Error | null, items: BroadcastInstance) => any
): Promise<BroadcastInstance> {
if (params instanceof Function) {
callback = params;
params = {};
Expand All @@ -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;
}
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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);
}
}


Loading

0 comments on commit d2476bb

Please sign in to comment.