Skip to content

Commit

Permalink
chore: setting header correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Dec 2, 2024
1 parent 0c23403 commit fb855a3
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/node/src/rest/api/v2010/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,14 @@ export class AccountContextImpl implements AccountContext {
remove(
callback?: (error: Error | null, item?: boolean) => any,
): Promise<boolean> {
const headers: any = {};

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});

operationPromise = instance._version.setPromiseCallback(
Expand All @@ -214,11 +217,15 @@ export class AccountContextImpl implements AccountContext {
fetch(
callback?: (error: Error | null, item?: AccountInstance) => any,
): Promise<AccountInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -254,6 +261,7 @@ export class AccountContextImpl implements AccountContext {

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
Expand Down Expand Up @@ -607,6 +615,7 @@ export function AccountListInstance(version: V2010): AccountListInstance {

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["xTwilioWebhookEnabled"] !== undefined)
headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"];

Expand Down Expand Up @@ -662,6 +671,7 @@ export function AccountListInstance(version: V2010): AccountListInstance {
if (params.pageToken !== undefined) data["PageToken"] = params.pageToken;

const headers: any = {};
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.page({
Expand Down
8 changes: 8 additions & 0 deletions examples/node/src/rest/api/v2010/account/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ export class CallContextImpl implements CallContext {
remove(
callback?: (error: Error | null, item?: boolean) => any,
): Promise<boolean> {
const headers: any = {};

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});

operationPromise = instance._version.setPromiseCallback(
Expand All @@ -123,11 +126,15 @@ export class CallContextImpl implements CallContext {
fetch(
callback?: (error: Error | null, item?: CallInstance) => any,
): Promise<CallInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -415,6 +422,7 @@ export function CallListInstance(

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class FeedbackCallSummaryContextImpl

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
Expand Down
4 changes: 4 additions & 0 deletions examples/node/src/rest/flexApi/v1/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ export class CallContextImpl implements CallContext {
update(
callback?: (error: Error | null, item?: CallInstance) => any,
): Promise<CallInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
headers,
});

operationPromise = operationPromise.then(
Expand Down
9 changes: 9 additions & 0 deletions examples/node/src/rest/flexApi/v1/credential/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ export class AwsContextImpl implements AwsContext {
remove(
callback?: (error: Error | null, item?: boolean) => any,
): Promise<boolean> {
const headers: any = {};

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});

operationPromise = instance._version.setPromiseCallback(
Expand All @@ -169,11 +172,15 @@ export class AwsContextImpl implements AwsContext {
fetch(
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -210,6 +217,7 @@ export class AwsContextImpl implements AwsContext {

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
Expand Down Expand Up @@ -485,6 +493,7 @@ export function AwsListInstance(version: V1): AwsListInstance {
if (params.pageToken !== undefined) data["PageToken"] = params.pageToken;

const headers: any = {};
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.page({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class HistoryContextImpl implements HistoryContext {
};

const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export function NewCredentialsListInstance(

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.create({
Expand Down
5 changes: 5 additions & 0 deletions examples/node/src/rest/versionless/deployed_devices/fleet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ export class FleetContextImpl implements FleetContext {
fetch(
callback?: (error: Error | null, item?: FleetInstance) => any,
): Promise<FleetInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -242,6 +246,7 @@ export function FleetListInstance(version: DeployedDevices): FleetListInstance {

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.create({
Expand Down
1 change: 1 addition & 0 deletions examples/node/src/rest/versionless/understand/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export function AssistantListInstance(
if (params.pageToken !== undefined) data["PageToken"] = params.pageToken;

const headers: any = {};
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.page({
Expand Down

0 comments on commit fb855a3

Please sign in to comment.