diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 760cac0d8f..55ff261a63 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - node: [ 14, 16, 18, lts/* ] + node: [ 14, 16, 18, 20, 22, lts/* ] steps: - name: Checkout twilio-node uses: actions/checkout@v3 @@ -41,6 +41,13 @@ jobs: TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }} TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }} TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} + TWILIO_ORGS_CLIENT_ID: ${{ secrets.TWILIO_ORGS_CLIENT_ID }} + TWILIO_ORGS_CLIENT_SECRET: ${{ secrets.TWILIO_ORGS_CLIENT_SECRET }} + TWILIO_ORGS_USER_ID: ${{ secrets.TWILIO_ORGS_USER_ID }} + TWILIO_ORG_SID: ${{ secrets.TWILIO_ORG_SID }} + TWILIO_CLIENT_ID: ${{ secrets.TWILIO_CLIENT_ID }} + TWILIO_CLIENT_SECRET: ${{ secrets.TWILIO_CLIENT_SECRET }} + TWILIO_MESSAGE_SID: ${{ secrets.TWILIO_MESSAGE_SID }} run: | npm pack tar -xzf twilio*.tgz diff --git a/CHANGES.md b/CHANGES.md index 1ceef063b5..c4af2075b3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,88 @@ twilio-node changelog ===================== +[2024-12-12] Version 5.4.0 +-------------------------- +**Library - Chore** +- [PR #1058](https://github.com/twilio/twilio-node/pull/1058): add v22 support. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Library - Feature** +- [PR #1057](https://github.com/twilio/twilio-node/pull/1057): add support for OAuth and Orgs API. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + + +[2024-12-05] Version 5.3.7 +-------------------------- +**Api** +- Add optional parameter `intelligence_service` to `transcription` +- Updated `phone_number_sid` to be populated for sip trunking terminating calls. + +**Numbers** +- Add Update Hosted Number Order V2 API endpoint +- Update Port in docs + +**Twiml** +- Add optional parameter `intelligence_service` to `` +- Add support for new `` and `` noun +- Add `events` attribute to `` verb + + +[2024-11-15] Version 5.3.6 +-------------------------- +**Library - Chore** +- [PR #1040](https://github.com/twilio/twilio-node/pull/1040): pass http agent options to client. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #1041](https://github.com/twilio/twilio-node/pull/1041): remove preview sync api. Thanks to [@sbansla](https://github.com/sbansla)! + +**Api** +- Added `ivr-virtual-agent-custom-voices` and `ivr-virtual-agent-genai` to `usage_record` API. +- Add open-api file tag to realtime_transcriptions + +**Taskrouter** +- Add `api-tag` property to workers reservation +- Add `api-tag` property to task reservation + + +[2024-10-24] Version 5.3.5 +-------------------------- +**Conversations** +- Expose ConversationWithParticipants resource that allows creating a conversation with participants + + +[2024-10-17] Version 5.3.4 +-------------------------- +**Api** +- Add response key `country` to fetch AvailablePhoneNumber resource by specific country. + +**Messaging** +- Make library and doc public for requestManagedCert Endpoint + + +[2024-10-03] Version 5.3.3 +-------------------------- +**Messaging** +- Add A2P external campaign CnpMigration flag + +**Numbers** +- Add address sid to portability API + +**Verify** +- Add `SnaClientToken` optional parameter on Verification check. +- Add `EnableSnaClientToken` optional parameter for Verification creation. + + +[2024-09-25] Version 5.3.2 +-------------------------- +**Library - Chore** +- [PR #1037](https://github.com/twilio/twilio-node/pull/1037): Sync for IoT has reached EOL; removing reference to Deployed Devices. Thanks to [@wanjunsli](https://github.com/wanjunsli)! + +**Accounts** +- Update docs and mounts. +- Change library visibility to public +- Enable consent and contact bulk upsert APIs in prod. + +**Serverless** +- Add is_plugin parameter in deployments api to check if it is plugins deployment + + [2024-09-18] Version 5.3.1 -------------------------- **Intelligence** diff --git a/README.md b/README.md index bfd0500d4c..8a4374f367 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,13 @@ After a brief delay, you will receive the text message on your phone. > **Warning** > It's okay to hardcode your credentials when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out [How to Set Environment Variables](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html) for more information. +## OAuth Feature for Twilio APIs +We are introducing Client Credentials Flow-based OAuth 2.0 authentication. This feature is currently in beta and its implementation is subject to change. + +API examples [here](https://github.com/twilio/twilio-node/blob/main/examples/public_oauth.js) + +Organisation API examples [here](https://github.com/twilio/twilio-node/blob/main/examples/orgs_api.js) + ## Usage Check out these [code examples](examples) in JavaScript and TypeScript to get up and running quickly. @@ -113,6 +120,27 @@ const client = require('twilio')(accountSid, authToken, { }); ``` +### Set HTTP Agent Options + +`twilio-node` allows you to set HTTP Agent Options in the Request Client. This feature allows you to re-use your connections. To enable this feature, instantiate the Twilio client with the `keepAlive` flag set to `true`. + +Optionally, the socket timeout and maximum number of sockets can also be set. See the example below: + +```javascript +const accountSid = process.env.TWILIO_ACCOUNT_SID; +const authToken = process.env.TWILIO_AUTH_TOKEN; + +const client = require('twilio')(accountSid, authToken, { + timeout: 30000, // HTTPS agent's socket timeout in milliseconds, default is 30000 + keepAlive: true, // https.Agent keepAlive option, default is false + keepAliveMsecs: 1000, // https.Agent keepAliveMsecs option in milliseconds, default is 1000 + maxSockets: 20, // https.Agent maxSockets option, default is 20 + maxTotalSockets: 100, // https.Agent maxTotalSockets option, default is 100 + maxFreeSockets: 5, // https.Agent maxFreeSockets option, default is 5 + scheduling: "lifo", // https.Agent scheduling option, default is 'lifo' +}); +``` + ### Specify Region and/or Edge To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/docs/global-infrastructure), specify the target Region and/or Edge for the client: diff --git a/examples/orgs_api.js b/examples/orgs_api.js new file mode 100644 index 0000000000..e85b3848e5 --- /dev/null +++ b/examples/orgs_api.js @@ -0,0 +1,37 @@ +"use strict"; +var Twilio = require("../lib"); + +const clientId = process.env.ORGS_CLIENT_ID; +const clientSecret = process.env.ORGS_CLIENT_SECRET; +const accountSid = process.env.TWILIO_ACCOUNT_SID; +const organizationSid = process.env.TWILIO_ORG_SID; + +const orgsCredentialProvider = new Twilio.OrgsCredentialProviderBuilder() + .setClientId(clientId) + .setClientSecret(clientSecret) + .build(); + +const client = new Twilio(); +client.setCredentialProvider(orgsCredentialProvider); +client.setAccountSid(accountSid); + +client.previewIam + .organization(organizationSid) + .accounts.list() + .then((accounts) => { + console.log(accounts); + }) + .catch((error) => { + console.log(error); + }); + +client.previewIam + .organization(organizationSid) + .accounts(accountSid) + .fetch() + .then((account) => { + console.log(account); + }) + .catch((error) => { + console.log(error); + }); diff --git a/examples/public_oauth.js b/examples/public_oauth.js new file mode 100644 index 0000000000..3f2ab8e73e --- /dev/null +++ b/examples/public_oauth.js @@ -0,0 +1,25 @@ +var Twilio = require("../lib"); + +const clientId = process.env.OAUTH_CLIENT_ID; +const clientSecret = process.env.OAUTH_CLIENT_SECRET; +const accountSid = process.env.TWILIO_ACCOUNT_SID; + +const clientCredentialProvider = new Twilio.ClientCredentialProviderBuilder() + .setClientId(clientId) + .setClientSecret(clientSecret) + .build(); + +const client = new Twilio(); +client.setCredentialProvider(clientCredentialProvider); +client.setAccountSid(accountSid); + +const messageId = "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; +client + .messages(messageId) + .fetch() + .then((message) => { + console.log(message); + }) + .catch((error) => { + console.log(error); + }); diff --git a/package.json b/package.json index c902ea7282..5618a90ba0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "twilio", "description": "A Twilio helper library", - "version": "5.3.1", + "version": "5.4.0", "author": "API Team ", "contributors": [ { diff --git a/spec/cluster/orgs_api.spec.ts b/spec/cluster/orgs_api.spec.ts new file mode 100644 index 0000000000..a0f3ac85b9 --- /dev/null +++ b/spec/cluster/orgs_api.spec.ts @@ -0,0 +1,89 @@ +jest.setTimeout(15000); + +import twilio from "twilio"; + +const clientId = process.env.TWILIO_ORGS_CLIENT_ID; +const clientSecret = process.env.TWILIO_ORGS_CLIENT_SECRET; +const organizationSid = process.env.TWILIO_ORG_SID; +const accountSid = process.env.TWILIO_ACCOUNT_SID; +const userId = process.env.TWILIO_ORGS_USER_ID; + +const client = twilio(); +const orgsCredentialProvider = new twilio.OrgsCredentialProviderBuilder() + .setClientId(clientId) + .setClientSecret(clientSecret) + .build(); +client.setCredentialProvider(orgsCredentialProvider); + +test("Should generate access token", () => { + const noAuthClient = twilio(); + noAuthClient.setCredentialProvider(new twilio.NoAuthCredentialProvider()); + return noAuthClient.previewIam.v1.token + .create({ + grantType: "client_credentials", + clientId: clientId, + clientSecret: clientSecret, + }) + .then((token) => { + expect(token).not.toBeNull(); + expect(token.accessToken).not.toBeUndefined(); + expect(token.tokenType).toEqual("Bearer"); + expect(token.expiresIn).toEqual(86400); + }); +}); + +test("Should list accounts under an organization", () => { + return client.previewIam + .organization(organizationSid) + .accounts.list() + .then((accounts) => { + expect(accounts).not.toBeNull(); + expect(accounts).not.toBeUndefined(); + expect(accounts.length).toBeGreaterThanOrEqual(0); + }); +}); + +test("Should fetch given account", () => { + return client.previewIam + .organization(organizationSid) + .accounts(accountSid) + .fetch() + .then((account) => { + expect(account).not.toBeNull(); + expect(account).not.toBeUndefined(); + expect(account.accountSid).toEqual(accountSid); + }); +}); + +test("Should list users", () => { + return client.previewIam + .organization(organizationSid) + .users.list() + .then((users) => { + expect(users).not.toBeNull(); + expect(users).not.toBeUndefined(); + expect(users.length).toBeGreaterThanOrEqual(0); + }); +}); + +test("Should fetch given user", () => { + return client.previewIam + .organization(organizationSid) + .users(userId) + .fetch() + .then((user) => { + expect(user).not.toBeNull(); + expect(user).not.toBeUndefined(); + expect(user.id).toEqual(userId); + }); +}); + +test("Should list role assignments", () => { + client.previewIam + .organization(organizationSid) + .roleAssignments.list({ scope: accountSid }) + .then((roles) => { + expect(roles).not.toBeNull(); + expect(roles.length).toBeGreaterThanOrEqual(0); + }); +}); diff --git a/spec/cluster/public_oauth.spec.ts b/spec/cluster/public_oauth.spec.ts new file mode 100644 index 0000000000..c5117264c7 --- /dev/null +++ b/spec/cluster/public_oauth.spec.ts @@ -0,0 +1,28 @@ +jest.setTimeout(15000); + +import twilio from "twilio"; + +const clientId = process.env.TWILIO_CLIENT_ID; +const clientSecret = process.env.TWILIO_CLIENT_SECRET; +const accountSid = process.env.TWILIO_ACCOUNT_SID; + +const clientCredentialProvider = new twilio.ClientCredentialProviderBuilder() + .setClientId(clientId) + .setClientSecret(clientSecret) + .build(); + +const client = twilio(); +client.setCredentialProvider(clientCredentialProvider); +client.setAccountSid(accountSid); + +test("Should fetch message", () => { + const messageId = process.env.TWILIO_MESSAGE_SID; + return client + .messages(messageId) + .fetch() + .then((message) => { + expect(message).not.toBeNull(); + expect(message).not.toBeUndefined(); + expect(message.sid).toEqual(messageId); + }); +}); diff --git a/spec/unit/auth_strategy/BasicAuthStrategy.spec.ts b/spec/unit/auth_strategy/BasicAuthStrategy.spec.ts new file mode 100644 index 0000000000..bb66d2f5df --- /dev/null +++ b/spec/unit/auth_strategy/BasicAuthStrategy.spec.ts @@ -0,0 +1,23 @@ +import BasicAuthStrategy from "../../../src/auth_strategy/BasicAuthStrategy"; + +describe("BasicAuthStrategy constructor", function () { + const username = "username"; + const password = "password"; + const basicAuthStrategy = new BasicAuthStrategy(username, password); + + it("Should have basic as its authType", function () { + expect(basicAuthStrategy.getAuthType()).toEqual("basic"); + }); + + it("Should return basic auth string", function (done) { + const auth = Buffer.from(username + ":" + password).toString("base64"); + basicAuthStrategy.getAuthString().then(function (authString) { + expect(authString).toEqual(`Basic ${auth}`); + done(); + }); + }); + + it("Should return true for requiresAuthentication", function () { + expect(basicAuthStrategy.requiresAuthentication()).toBe(true); + }); +}); diff --git a/spec/unit/auth_strategy/NoAuthStrategy.spec.ts b/spec/unit/auth_strategy/NoAuthStrategy.spec.ts new file mode 100644 index 0000000000..08a31da11c --- /dev/null +++ b/spec/unit/auth_strategy/NoAuthStrategy.spec.ts @@ -0,0 +1,20 @@ +import NoAuthStrategy from "../../../src/auth_strategy/NoAuthStrategy"; + +describe("NoAuthStrategy constructor", function () { + const noAuthStrategy = new NoAuthStrategy(); + + it("Should have noauth as its authType", function () { + expect(noAuthStrategy.getAuthType()).toEqual("noauth"); + }); + + it("Should return an empty string for getAuthString", function (done) { + noAuthStrategy.getAuthString().then(function (authString) { + expect(authString).toEqual(""); + done(); + }); + }); + + it("Should return false for requiresAuthentication", function () { + expect(noAuthStrategy.requiresAuthentication()).toBe(false); + }); +}); diff --git a/spec/unit/auth_strategy/TokenAuthStrategy.spec.ts b/spec/unit/auth_strategy/TokenAuthStrategy.spec.ts new file mode 100644 index 0000000000..909a1bcf9a --- /dev/null +++ b/spec/unit/auth_strategy/TokenAuthStrategy.spec.ts @@ -0,0 +1,126 @@ +import TokenAuthStrategy from "../../../src/auth_strategy/TokenAuthStrategy"; +import ApiTokenManager from "../../../src/http/bearer_token/ApiTokenManager"; +import { jest } from "@jest/globals"; +import axios from "axios"; +import twilio from "../../../src"; + +function createMockAxios(promiseHandler: Promise) { + const instance = () => promiseHandler; + instance.defaults = { + headers: { + post: {}, + }, + }; + return instance; +} + +describe("TokenAuthStrategy constructor", function () { + const clientId = "clientId"; + const clientSecret = "clientSecret"; + const grantType = "client_credentials"; + + const tokenManager = new ApiTokenManager({ + grantType: grantType, + clientId: clientId, + clientSecret: clientSecret, + }); + const tokenAuthStrategy = new TokenAuthStrategy(tokenManager); + + let createSpy: jest.Spied; + const initialHttpProxyValue = process.env.HTTP_PROXY; + + beforeEach(() => { + createSpy = jest.spyOn(axios, "create"); + createSpy.mockReturnValue( + createMockAxios( + Promise.resolve({ + status: 200, + data: { + access_token: "accessTokenValue", + token_type: "Bearer", + }, + }) + ) + ); + }); + + afterEach(() => { + createSpy.mockRestore(); + + if (initialHttpProxyValue) { + process.env.HTTP_PROXY = initialHttpProxyValue; + } else { + delete process.env.HTTP_PROXY; + } + }); + + it("Should have token as its authType", function () { + expect(tokenAuthStrategy.getAuthType()).toEqual("token"); + }); + + it("Should check token expiry", function () { + const accountSid = "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + const keySid = "SKb5aed9ca12bf5890f37930e63cad6d38"; + const token = new twilio.jwt.AccessToken(accountSid, keySid, "secret", { + identity: "ID@example.com", + }); + expect(tokenAuthStrategy.isTokenExpired(token.toJwt())).toBe(false); + }); + + it("Should return token auth string", function (done) { + tokenAuthStrategy.getAuthString().then(function (authString) { + expect(authString).toEqual(`Bearer accessTokenValue`); + done(); + }); + }); + + it("Should return true for requiresAuthentication", function () { + expect(tokenAuthStrategy.requiresAuthentication()).toBe(true); + }); +}); + +describe("TokenAuthStrategy error response", function () { + const clientId = "clientId"; + const clientSecret = "clientSecret"; + const grantType = "client_credentials"; + + const tokenManager = new ApiTokenManager({ + grantType: grantType, + clientId: clientId, + clientSecret: clientSecret, + }); + const tokenAuthStrategy = new TokenAuthStrategy(tokenManager); + + let createSpy: jest.Spied; + const initialHttpProxyValue = process.env.HTTP_PROXY; + + beforeEach(() => { + createSpy = jest.spyOn(axios, "create"); + createSpy.mockReturnValue( + createMockAxios( + Promise.resolve({ + status: 403, + data: { + message: "Invalid Credentials", + }, + }) + ) + ); + }); + + afterEach(() => { + createSpy.mockRestore(); + + if (initialHttpProxyValue) { + process.env.HTTP_PROXY = initialHttpProxyValue; + } else { + delete process.env.HTTP_PROXY; + } + }); + + it("Should return error", async function () { + await expect(tokenAuthStrategy.getAuthString()).rejects.toThrow( + "Failed to fetch access token: Invalid Credentials" + ); + }); +}); diff --git a/spec/unit/base/RequestClient.spec.js b/spec/unit/base/RequestClient.spec.js index 310b92ef37..b16e697fae 100644 --- a/spec/unit/base/RequestClient.spec.js +++ b/spec/unit/base/RequestClient.spec.js @@ -57,19 +57,17 @@ describe("RequestClient constructor", function () { 30000 ); expect(requestClient.axios.defaults.httpsAgent.options.keepAlive).toBe( - undefined + true ); expect(requestClient.axios.defaults.httpsAgent.options.keepAliveMsecs).toBe( undefined ); - expect(requestClient.axios.defaults.httpsAgent.options.maxSockets).toBe( - undefined - ); + expect(requestClient.axios.defaults.httpsAgent.options.maxSockets).toBe(20); expect( requestClient.axios.defaults.httpsAgent.options.maxTotalSockets - ).toBe(undefined); + ).toBe(100); expect(requestClient.axios.defaults.httpsAgent.options.maxFreeSockets).toBe( - undefined + 5 ); expect(requestClient.axios.defaults.httpsAgent.options.scheduling).toBe( undefined @@ -156,14 +154,12 @@ describe("RequestClient constructor", function () { expect(requestClient.axios.defaults.httpsAgent.options.keepAliveMsecs).toBe( undefined ); - expect(requestClient.axios.defaults.httpsAgent.options.maxSockets).toBe( - undefined - ); + expect(requestClient.axios.defaults.httpsAgent.options.maxSockets).toBe(20); expect( requestClient.axios.defaults.httpsAgent.options.maxTotalSockets ).toEqual(1500); expect(requestClient.axios.defaults.httpsAgent.options.maxFreeSockets).toBe( - undefined + 5 ); expect(requestClient.axios.defaults.httpsAgent.options.scheduling).toEqual( "lifo" @@ -222,7 +218,7 @@ describe("lastResponse and lastRequest defined", function () { expect(client.lastRequest.headers).toEqual({ "test-header-key": "test-header-value", Authorization: "Basic dGVzdC11c2VybmFtZTp0ZXN0LXBhc3N3b3Jk", - Connection: "close", + Connection: "keep-alive", }); expect(client.lastRequest.data).toEqual({ "test-data-key": "test-data-value", @@ -288,7 +284,7 @@ describe("lastRequest defined, lastResponse undefined", function () { expect(client.lastRequest.headers).toEqual({ "test-header-key": "test-header-value", Authorization: "Basic dGVzdC11c2VybmFtZTp0ZXN0LXBhc3N3b3Jk", - Connection: "close", + Connection: "keep-alive", }); expect(client.lastRequest.data).toEqual({ "test-data-key": "test-data-value", diff --git a/spec/unit/credential_provider/ClientCredentialProvider.spec.ts b/spec/unit/credential_provider/ClientCredentialProvider.spec.ts new file mode 100644 index 0000000000..ad2a7e154f --- /dev/null +++ b/spec/unit/credential_provider/ClientCredentialProvider.spec.ts @@ -0,0 +1,22 @@ +import ClientCredentialProvider from "../../../src/credential_provider/ClientCredentialProvider"; +import TokenAuthStrategy from "../../../src/auth_strategy/TokenAuthStrategy"; + +describe("ClientCredentialProvider Constructor", () => { + const clientCredentialProvider = + new ClientCredentialProvider.ClientCredentialProviderBuilder() + .setClientId("clientId") + .setClientSecret("clientSecret") + .build(); + + it("Should have client-credentials as its authType", () => { + expect(clientCredentialProvider.getAuthType()).toEqual( + "client-credentials" + ); + }); + + it("Should return NoAuthStrategy as its auth strategy", () => { + expect(clientCredentialProvider.toAuthStrategy()).toBeInstanceOf( + TokenAuthStrategy + ); + }); +}); diff --git a/spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts b/spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts new file mode 100644 index 0000000000..8c2c5d4f68 --- /dev/null +++ b/spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts @@ -0,0 +1,18 @@ +import NoAuthCredentialProvider from "../../../src/credential_provider/NoAuthCredentialProvider"; +import NoAuthStrategy from "../../../src/auth_strategy/NoAuthStrategy"; +import Twilio from "../../../src"; + +describe("NoAuthCredentialProvider Constructor", () => { + const noAuthCredentialProvider = + new NoAuthCredentialProvider.NoAuthCredentialProvider(); + + it("Should have client-credentials as its authType", () => { + expect(noAuthCredentialProvider.getAuthType()).toEqual("noauth"); + }); + + it("Should return NoAuthStrategy as its auth strategy", () => { + expect(noAuthCredentialProvider.toAuthStrategy()).toBeInstanceOf( + NoAuthStrategy + ); + }); +}); diff --git a/spec/unit/credential_provider/OrgsCredentialProvider.spec.ts b/spec/unit/credential_provider/OrgsCredentialProvider.spec.ts new file mode 100644 index 0000000000..4c0ca203e7 --- /dev/null +++ b/spec/unit/credential_provider/OrgsCredentialProvider.spec.ts @@ -0,0 +1,20 @@ +import OrgsCredentialProvider from "../../../src/credential_provider/OrgsCredentialProvider"; +import TokenAuthStrategy from "../../../src/auth_strategy/TokenAuthStrategy"; + +describe("OrgsCredentialProvider Constructor", () => { + const orgsCredentialProvider = + new OrgsCredentialProvider.OrgsCredentialProviderBuilder() + .setClientId("clientId") + .setClientSecret("clientSecret") + .build(); + + it("Should have client-credentials as its authType", () => { + expect(orgsCredentialProvider.getAuthType()).toEqual("client-credentials"); + }); + + it("Should return NoAuthStrategy as its auth strategy", () => { + expect(orgsCredentialProvider.toAuthStrategy()).toBeInstanceOf( + TokenAuthStrategy + ); + }); +}); diff --git a/spec/unit/http/bearer_token/ApiTokenManager.spec.ts b/spec/unit/http/bearer_token/ApiTokenManager.spec.ts new file mode 100644 index 0000000000..f470f26379 --- /dev/null +++ b/spec/unit/http/bearer_token/ApiTokenManager.spec.ts @@ -0,0 +1,122 @@ +import ApiTokenManager from "../../../../src/http/bearer_token/ApiTokenManager"; +import axios from "axios"; +import { jest } from "@jest/globals"; + +function createMockAxios(promiseHandler: Promise) { + const instance = () => promiseHandler; + instance.defaults = { + headers: { + post: {}, + }, + }; + return instance; +} + +describe("ApiTokenManager constructor", function () { + const clientId = "clientId"; + const clientSecret = "clientSecret"; + const grantType = "client_credentials"; + + const apiTokenManager = new ApiTokenManager({ + grantType: grantType, + clientId: clientId, + clientSecret: clientSecret, + }); + + const params = apiTokenManager.getParams(); + + let createSpy: jest.Spied; + const initialHttpProxyValue = process.env.HTTP_PROXY; + + beforeEach(() => { + createSpy = jest.spyOn(axios, "create"); + createSpy.mockReturnValue( + createMockAxios( + Promise.resolve({ + status: 200, + data: { + access_token: "accessTokenValue", + expires_in: 86400, + id_token: null, + refresh_token: null, + token_type: "Bearer", + }, + }) + ) + ); + }); + + afterEach(() => { + createSpy.mockRestore(); + + if (initialHttpProxyValue) { + process.env.HTTP_PROXY = initialHttpProxyValue; + } else { + delete process.env.HTTP_PROXY; + } + }); + + it("Should have client-credentials as its grantType", function () { + expect(params.grantType).toEqual(grantType); + }); + + it("Should have clientId as its clientId", function () { + expect(params.clientId).toEqual(clientId); + }); + + it("Should have clientSecret as its clientSecret", function () { + expect(params.clientSecret).toEqual(clientSecret); + }); + + it("Should return an access token", async function () { + const token = await apiTokenManager.fetchToken(); + expect(token).toEqual("accessTokenValue"); + }); +}); + +describe("ApiTokenManager with error response", function () { + const clientId = "clientId"; + const clientSecret = "clientSecret"; + const grantType = "client_credentials"; + + const apiTokenManager = new ApiTokenManager({ + grantType: grantType, + clientId: clientId, + clientSecret: clientSecret, + }); + + const params = apiTokenManager.getParams(); + + let createSpy: jest.Spied; + const initialHttpProxyValue = process.env.HTTP_PROXY; + + beforeEach(() => { + createSpy = jest.spyOn(axios, "create"); + createSpy.mockReturnValue( + createMockAxios( + Promise.resolve({ + status: 400, + data: { + message: "Token error", + }, + }) + ) + ); + }); + + afterEach(() => { + createSpy.mockRestore(); + + if (initialHttpProxyValue) { + process.env.HTTP_PROXY = initialHttpProxyValue; + } else { + delete process.env.HTTP_PROXY; + } + }); + + it("Should return error message", async function () { + await expect(apiTokenManager.fetchToken()).rejects.toThrow( + `Error Status Code: 400\nFailed to fetch access token: Token error` + ); + }); +}); diff --git a/spec/unit/http/bearer_token/OrgsTokenManager.spec.ts b/spec/unit/http/bearer_token/OrgsTokenManager.spec.ts new file mode 100644 index 0000000000..c353d44021 --- /dev/null +++ b/spec/unit/http/bearer_token/OrgsTokenManager.spec.ts @@ -0,0 +1,122 @@ +import OrgsTokenManager from "../../../../src/http/bearer_token/OrgsTokenManager"; +import axios from "axios"; +import { jest } from "@jest/globals"; + +function createMockAxios(promiseHandler: Promise) { + const instance = () => promiseHandler; + instance.defaults = { + headers: { + post: {}, + }, + }; + return instance; +} + +describe("OrgsTokenManager constructor", function () { + const clientId = "clientId"; + const clientSecret = "clientSecret"; + const grantType = "client_credentials"; + + const orgsTokenManager = new OrgsTokenManager({ + grantType: grantType, + clientId: clientId, + clientSecret: clientSecret, + }); + + const params = orgsTokenManager.getParams(); + + let createSpy: jest.Spied; + const initialHttpProxyValue = process.env.HTTP_PROXY; + + beforeEach(() => { + createSpy = jest.spyOn(axios, "create"); + createSpy.mockReturnValue( + createMockAxios( + Promise.resolve({ + status: 200, + data: { + access_token: "accessTokenValue", + expires_in: 86400, + id_token: null, + refresh_token: null, + token_type: "Bearer", + }, + }) + ) + ); + }); + + afterEach(() => { + createSpy.mockRestore(); + + if (initialHttpProxyValue) { + process.env.HTTP_PROXY = initialHttpProxyValue; + } else { + delete process.env.HTTP_PROXY; + } + }); + + it("Should have client-credentials as its grantType", function () { + expect(params.grantType).toEqual(grantType); + }); + + it("Should have clientId as its clientId", function () { + expect(params.clientId).toEqual(clientId); + }); + + it("Should have clientSecret as its clientSecret", function () { + expect(params.clientSecret).toEqual(clientSecret); + }); + + it("Should return an access token", async function () { + const token = await orgsTokenManager.fetchToken(); + expect(token).toEqual("accessTokenValue"); + }); +}); + +describe("OrgsTokenManager with error response", function () { + const clientId = "clientId"; + const clientSecret = "clientSecret"; + const grantType = "client_credentials"; + + const orgsTokenManager = new OrgsTokenManager({ + grantType: grantType, + clientId: clientId, + clientSecret: clientSecret, + }); + + const params = orgsTokenManager.getParams(); + + let createSpy: jest.Spied; + const initialHttpProxyValue = process.env.HTTP_PROXY; + + beforeEach(() => { + createSpy = jest.spyOn(axios, "create"); + createSpy.mockReturnValue( + createMockAxios( + Promise.resolve({ + status: 400, + data: { + message: "Token error", + }, + }) + ) + ); + }); + + afterEach(() => { + createSpy.mockRestore(); + + if (initialHttpProxyValue) { + process.env.HTTP_PROXY = initialHttpProxyValue; + } else { + delete process.env.HTTP_PROXY; + } + }); + + it("Should return error message", async function () { + await expect(orgsTokenManager.fetchToken()).rejects.toThrow( + `Error Status Code: 400\nFailed to fetch access token: Token error` + ); + }); +}); diff --git a/src/auth_strategy/AuthStrategy.ts b/src/auth_strategy/AuthStrategy.ts new file mode 100644 index 0000000000..44568ac69f --- /dev/null +++ b/src/auth_strategy/AuthStrategy.ts @@ -0,0 +1,11 @@ +export default abstract class AuthStrategy { + private authType: string; + protected constructor(authType: string) { + this.authType = authType; + } + getAuthType(): string { + return this.authType; + } + abstract getAuthString(): Promise; + abstract requiresAuthentication(): boolean; +} diff --git a/src/auth_strategy/BasicAuthStrategy.ts b/src/auth_strategy/BasicAuthStrategy.ts new file mode 100644 index 0000000000..ecee933fb7 --- /dev/null +++ b/src/auth_strategy/BasicAuthStrategy.ts @@ -0,0 +1,23 @@ +import AuthStrategy from "./AuthStrategy"; + +export default class BasicAuthStrategy extends AuthStrategy { + private username: string; + private password: string; + + constructor(username: string, password: string) { + super("basic"); + this.username = username; + this.password = password; + } + + getAuthString(): Promise { + const auth = Buffer.from(this.username + ":" + this.password).toString( + "base64" + ); + return Promise.resolve(`Basic ${auth}`); + } + + requiresAuthentication(): boolean { + return true; + } +} diff --git a/src/auth_strategy/NoAuthStrategy.ts b/src/auth_strategy/NoAuthStrategy.ts new file mode 100644 index 0000000000..069a8844a3 --- /dev/null +++ b/src/auth_strategy/NoAuthStrategy.ts @@ -0,0 +1,15 @@ +import AuthStrategy from "./AuthStrategy"; + +export default class NoAuthStrategy extends AuthStrategy { + constructor() { + super("noauth"); + } + + getAuthString(): Promise { + return Promise.resolve(""); + } + + requiresAuthentication(): boolean { + return false; + } +} diff --git a/src/auth_strategy/TokenAuthStrategy.ts b/src/auth_strategy/TokenAuthStrategy.ts new file mode 100644 index 0000000000..147f8a9f0b --- /dev/null +++ b/src/auth_strategy/TokenAuthStrategy.ts @@ -0,0 +1,67 @@ +import AuthStrategy from "./AuthStrategy"; +import TokenManager from "../http/bearer_token/TokenManager"; +import jwt, { JwtPayload } from "jsonwebtoken"; + +export default class TokenAuthStrategy extends AuthStrategy { + private token: string; + private tokenManager: TokenManager; + + constructor(tokenManager: TokenManager) { + super("token"); + this.token = ""; + this.tokenManager = tokenManager; + } + + async getAuthString(): Promise { + return this.fetchToken() + .then((token) => { + this.token = token; + return `Bearer ${this.token}`; + }) + .catch((error) => { + throw new Error(`Failed to fetch access token: ${error.message}`); + }); + } + + requiresAuthentication(): boolean { + return true; + } + + async fetchToken(): Promise { + if ( + this.token == null || + this.token.length === 0 || + this.isTokenExpired(this.token) + ) { + return this.tokenManager.fetchToken(); + } + return Promise.resolve(this.token); + } + + /** + * Function to check if the token is expired with a buffer of 30 seconds. + * @param token - The JWT token as a string. + * @returns Boolean indicating if the token is expired. + */ + isTokenExpired(token: string): boolean { + try { + // Decode the token without verifying the signature, as we only want to read the expiration for this check + const decoded = jwt.decode(token) as JwtPayload; + + if (!decoded || !decoded.exp) { + // If the token doesn't have an expiration, consider it expired + return true; + } + + const expiresAt = decoded.exp * 1000; + const bufferMilliseconds = 30 * 1000; + const bufferExpiresAt = expiresAt - bufferMilliseconds; + + // Return true if the current time is after the expiration time with buffer + return Date.now() > bufferExpiresAt; + } catch (error) { + // If there's an error decoding the token, consider it expired + return true; + } + } +} diff --git a/src/base/BaseTwilio.ts b/src/base/BaseTwilio.ts index f6651c8a7c..3020bc9c96 100644 --- a/src/base/BaseTwilio.ts +++ b/src/base/BaseTwilio.ts @@ -1,6 +1,8 @@ import RequestClient from "./RequestClient"; /* jshint ignore:line */ import { HttpMethod } from "../interfaces"; /* jshint ignore:line */ import { Headers } from "../http/request"; /* jshint ignore:line */ +import AuthStrategy from "../auth_strategy/AuthStrategy"; /* jshint ignore:line */ +import CredentialProvider from "../credential_provider/CredentialProvider"; /* jshint ignore:line */ const os = require("os"); /* jshint ignore:line */ const url = require("url"); /* jshint ignore:line */ @@ -19,7 +21,20 @@ namespace Twilio { logLevel?: string; userAgentExtensions?: string[]; autoRetry?: boolean; + maxRetryDelay?: number; maxRetries?: number; + + /** + https.Agent options + */ + timeout?: number; + keepAlive?: boolean; + keepAliveMsecs?: number; + maxSockets?: number; + maxTotalSockets?: number; + maxFreeSockets?: number; + scheduling?: "fifo" | "lifo" | undefined; + ca?: string | Buffer; } export interface RequestOpts { @@ -27,6 +42,7 @@ namespace Twilio { uri?: string; username?: string; password?: string; + authStrategy?: AuthStrategy; headers?: Headers; params?: object; data?: object; @@ -43,16 +59,31 @@ namespace Twilio { /* jshint ignore:end */ export class Client { - username: string; - password: string; + username?: string; + password?: string; accountSid: string; + credentialProvider?: CredentialProvider; opts?: ClientOpts; env?: NodeJS.ProcessEnv; edge?: string; region?: string; logLevel?: string; - autoRetry: boolean; + autoRetry?: boolean; + maxRetryDelay?: number; maxRetries?: number; + + /** + https.Agent options + */ + timeout?: number; + keepAlive?: boolean; + keepAliveMsecs?: number; + maxSockets?: number; + maxTotalSockets?: number; + maxFreeSockets?: number; + scheduling?: "fifo" | "lifo" | undefined; + ca?: string | Buffer; + userAgentExtensions?: string[]; _httpClient?: RequestClient; @@ -74,23 +105,23 @@ namespace Twilio { /* jshint ignore:end */ constructor(username?: string, password?: string, opts?: ClientOpts) { - this.opts = opts || {}; - this.env = this.opts.env || {}; + this.setOpts(opts); this.username = username ?? - this.env.TWILIO_ACCOUNT_SID ?? - process.env.TWILIO_ACCOUNT_SID ?? - (() => { - throw new Error("username is required"); - })(); + this.env?.TWILIO_ACCOUNT_SID ?? + process.env.TWILIO_ACCOUNT_SID; this.password = password ?? - this.env.TWILIO_AUTH_TOKEN ?? - process.env.TWILIO_AUTH_TOKEN ?? - (() => { - throw new Error("password is required"); - })(); - this.accountSid = this.opts.accountSid || this.username; + this.env?.TWILIO_AUTH_TOKEN ?? + process.env.TWILIO_AUTH_TOKEN; + this.accountSid = ""; + this.setAccountSid(this.opts?.accountSid || this.username); + this.invalidateOAuth(); + } + + setOpts(opts?: ClientOpts) { + this.opts = opts || {}; + this.env = this.opts.env || {}; this.edge = this.opts.edge ?? this.env.TWILIO_EDGE ?? process.env.TWILIO_EDGE; this.region = @@ -99,7 +130,17 @@ namespace Twilio { this.opts.logLevel ?? this.env.TWILIO_LOG_LEVEL ?? process.env.TWILIO_LOG_LEVEL; + + this.timeout = this.opts.timeout; + this.keepAlive = this.opts.keepAlive; + this.keepAliveMsecs = this.opts.keepAliveMsecs; + this.maxSockets = this.opts.maxSockets; + this.maxTotalSockets = this.opts.maxTotalSockets; + this.maxFreeSockets = this.opts.maxFreeSockets; + this.scheduling = this.opts.scheduling; + this.ca = this.opts.ca; this.autoRetry = this.opts.autoRetry || false; + this.maxRetryDelay = this.opts.maxRetryDelay; this.maxRetries = this.opts.maxRetries; this.userAgentExtensions = this.opts.userAgentExtensions || []; this._httpClient = this.opts.httpClient; @@ -107,9 +148,13 @@ namespace Twilio { if (this.opts.lazyLoading === false) { this._httpClient = this.httpClient; } + } + + setAccountSid(accountSid?: string) { + this.accountSid = accountSid || ""; - if (!this.accountSid.startsWith("AC")) { - const apiKeyMsg = this.accountSid.startsWith("SK") + if (this.accountSid && !this.accountSid?.startsWith("AC")) { + const apiKeyMsg = this.accountSid?.startsWith("SK") ? ". The given SID indicates an API Key which requires the accountSid to be passed as an additional option" : ""; @@ -117,10 +162,34 @@ namespace Twilio { } } + setCredentialProvider(credentialProvider: CredentialProvider) { + this.credentialProvider = credentialProvider; + this.accountSid = ""; + this.invalidateBasicAuth(); + } + + invalidateBasicAuth() { + this.username = undefined; + this.password = undefined; + } + + invalidateOAuth() { + this.credentialProvider = undefined; + } + get httpClient() { if (!this._httpClient) { this._httpClient = new RequestClient({ + timeout: this.timeout, + keepAlive: this.keepAlive, + keepAliveMsecs: this.keepAliveMsecs, + maxSockets: this.maxSockets, + maxTotalSockets: this.maxTotalSockets, + maxFreeSockets: this.maxFreeSockets, + scheduling: this.scheduling, + ca: this.ca, autoRetry: this.autoRetry, + maxRetryDelay: this.maxRetryDelay, maxRetries: this.maxRetries, }); } @@ -150,6 +219,22 @@ namespace Twilio { const username = opts.username || this.username; const password = opts.password || this.password; + const authStrategy = + opts.authStrategy || this.credentialProvider?.toAuthStrategy(); + + if (!authStrategy) { + if (!username) { + (() => { + throw new Error("username is required"); + })(); + } + + if (!password) { + (() => { + throw new Error("password is required"); + })(); + } + } const headers = opts.headers || {}; @@ -177,7 +262,7 @@ namespace Twilio { headers["Content-Type"] = "application/x-www-form-urlencoded"; } - if (!headers["Accept"]) { + if (opts.method !== "delete" && !headers["Accept"]) { headers["Accept"] = "application/json"; } @@ -189,6 +274,7 @@ namespace Twilio { uri: uri.href, username: username, password: password, + authStrategy: authStrategy, headers: headers, params: opts.params, data: opts.data, diff --git a/src/base/Page.ts b/src/base/Page.ts index 2230e47159..e2062e2700 100644 --- a/src/base/Page.ts +++ b/src/base/Page.ts @@ -249,6 +249,8 @@ export default class Page< if (keys.length === 1) { return payload[keys[0]]; } + for (const key of keys) + if (Array.isArray(payload[key])) return payload[key]; throw new Error("Page Records cannot be deserialized"); } diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index a7d1c5531b..4fb29bb534 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -6,15 +6,19 @@ import qs from "qs"; import * as https from "https"; import Response from "../http/response"; import Request, { - RequestOptions as LastRequestOptions, Headers, + RequestOptions as LastRequestOptions, } from "../http/request"; +import AuthStrategy from "../auth_strategy/AuthStrategy"; const DEFAULT_CONTENT_TYPE = "application/x-www-form-urlencoded"; const DEFAULT_TIMEOUT = 30000; const DEFAULT_INITIAL_RETRY_INTERVAL_MILLIS = 100; const DEFAULT_MAX_RETRY_DELAY = 3000; const DEFAULT_MAX_RETRIES = 3; +const DEFAULT_MAX_SOCKETS = 20; +const DEFAULT_MAX_FREE_SOCKETS = 5; +const DEFAULT_MAX_TOTAL_SOCKETS = 100; interface BackoffAxiosRequestConfig extends AxiosRequestConfig { /** @@ -73,6 +77,7 @@ class RequestClient { autoRetry: boolean; maxRetryDelay: number; maxRetries: number; + keepAlive: boolean; /** * Make http request @@ -94,15 +99,16 @@ class RequestClient { this.autoRetry = opts.autoRetry || false; this.maxRetryDelay = opts.maxRetryDelay || DEFAULT_MAX_RETRY_DELAY; this.maxRetries = opts.maxRetries || DEFAULT_MAX_RETRIES; + this.keepAlive = opts.keepAlive !== false; // construct an https agent let agentOpts: https.AgentOptions = { timeout: this.defaultTimeout, - keepAlive: opts.keepAlive, + keepAlive: this.keepAlive, keepAliveMsecs: opts.keepAliveMsecs, - maxSockets: opts.maxSockets, - maxTotalSockets: opts.maxTotalSockets, - maxFreeSockets: opts.maxFreeSockets, + maxSockets: opts.maxSockets || DEFAULT_MAX_SOCKETS, // no of sockets open per host + maxTotalSockets: opts.maxTotalSockets || DEFAULT_MAX_TOTAL_SOCKETS, // no of sockets open in total + maxFreeSockets: opts.maxFreeSockets || DEFAULT_MAX_FREE_SOCKETS, // no of free sockets open per host scheduling: opts.scheduling, ca: opts.ca, }; @@ -144,6 +150,7 @@ class RequestClient { * @param opts.uri - The request uri * @param opts.username - The username used for auth * @param opts.password - The password used for auth + * @param opts.authStrategy - The authStrategy for API call * @param opts.headers - The request headers * @param opts.params - The request params * @param opts.data - The request data @@ -152,7 +159,7 @@ class RequestClient { * @param opts.forever - Set to true to use the forever-agent * @param opts.logLevel - Show debug logs */ - request( + async request( opts: RequestClient.RequestOptions ): Promise> { if (!opts.method) { @@ -165,11 +172,8 @@ class RequestClient { var headers = opts.headers || {}; - if (!headers.Connection && !headers.connection && opts.forever) { - headers.Connection = "keep-alive"; - } else if (!headers.Connection && !headers.connection) { - headers.Connection = "close"; - } + if (!headers.Connection && !headers.connection) + headers.Connection = this.keepAlive ? "keep-alive" : "close"; let auth = undefined; @@ -178,6 +182,8 @@ class RequestClient { "base64" ); headers.Authorization = "Basic " + auth; + } else if (opts.authStrategy) { + headers.Authorization = await opts.authStrategy.getAuthString(); } const options: AxiosRequestConfig = { @@ -294,6 +300,10 @@ namespace RequestClient { * The password used for auth */ password?: string; + /** + * The AuthStrategy for API Call + */ + authStrategy?: AuthStrategy; /** * The request headers */ diff --git a/src/credential_provider/ClientCredentialProvider.ts b/src/credential_provider/ClientCredentialProvider.ts new file mode 100644 index 0000000000..c1253b0902 --- /dev/null +++ b/src/credential_provider/ClientCredentialProvider.ts @@ -0,0 +1,66 @@ +import CredentialProvider from "./CredentialProvider"; +import TokenManager from "../http/bearer_token/TokenManager"; +import AuthStrategy from "../auth_strategy/AuthStrategy"; +import ApiTokenManager from "../http/bearer_token/ApiTokenManager"; +import TokenAuthStrategy from "../auth_strategy/TokenAuthStrategy"; + +class ClientCredentialProvider extends CredentialProvider { + grantType: string; + clientId: string; + clientSecret: string; + tokenManager: TokenManager | null; + + constructor() { + super("client-credentials"); + this.grantType = "client_credentials"; + this.clientId = ""; + this.clientSecret = ""; + this.tokenManager = null; + } + + public toAuthStrategy(): AuthStrategy { + if (this.tokenManager == null) { + this.tokenManager = new ApiTokenManager({ + grantType: this.grantType, + clientId: this.clientId, + clientSecret: this.clientSecret, + }); + } + return new TokenAuthStrategy(this.tokenManager); + } +} + +namespace ClientCredentialProvider { + export class ClientCredentialProviderBuilder { + private readonly instance: ClientCredentialProvider; + + constructor() { + this.instance = new ClientCredentialProvider(); + } + + public setClientId(clientId: string): ClientCredentialProviderBuilder { + this.instance.clientId = clientId; + return this; + } + + public setClientSecret( + clientSecret: string + ): ClientCredentialProviderBuilder { + this.instance.clientSecret = clientSecret; + return this; + } + + public setTokenManager( + tokenManager: TokenManager + ): ClientCredentialProviderBuilder { + this.instance.tokenManager = tokenManager; + return this; + } + + public build(): ClientCredentialProvider { + return this.instance; + } + } +} + +export = ClientCredentialProvider; diff --git a/src/credential_provider/CredentialProvider.ts b/src/credential_provider/CredentialProvider.ts new file mode 100644 index 0000000000..759f4d8f08 --- /dev/null +++ b/src/credential_provider/CredentialProvider.ts @@ -0,0 +1,12 @@ +import AuthStrategy from "../auth_strategy/AuthStrategy"; + +export default abstract class CredentialProvider { + private authType: string; + protected constructor(authType: string) { + this.authType = authType; + } + getAuthType(): string { + return this.authType; + } + abstract toAuthStrategy(): AuthStrategy; +} diff --git a/src/credential_provider/NoAuthCredentialProvider.ts b/src/credential_provider/NoAuthCredentialProvider.ts new file mode 100644 index 0000000000..c36d9013f5 --- /dev/null +++ b/src/credential_provider/NoAuthCredentialProvider.ts @@ -0,0 +1,17 @@ +import CredentialProvider from "./CredentialProvider"; +import AuthStrategy from "../auth_strategy/AuthStrategy"; +import NoAuthStrategy from "../auth_strategy/NoAuthStrategy"; + +namespace NoAuthCredentialProvider { + export class NoAuthCredentialProvider extends CredentialProvider { + constructor() { + super("noauth"); + } + + public toAuthStrategy(): AuthStrategy { + return new NoAuthStrategy(); + } + } +} + +export = NoAuthCredentialProvider; diff --git a/src/credential_provider/OrgsCredentialProvider.ts b/src/credential_provider/OrgsCredentialProvider.ts new file mode 100644 index 0000000000..c1dfe3124e --- /dev/null +++ b/src/credential_provider/OrgsCredentialProvider.ts @@ -0,0 +1,66 @@ +import CredentialProvider from "./CredentialProvider"; +import TokenManager from "../http/bearer_token/TokenManager"; +import AuthStrategy from "../auth_strategy/AuthStrategy"; +import OrgsTokenManager from "../http/bearer_token/OrgsTokenManager"; +import TokenAuthStrategy from "../auth_strategy/TokenAuthStrategy"; + +class OrgsCredentialProvider extends CredentialProvider { + grantType: string; + clientId: string; + clientSecret: string; + tokenManager: TokenManager | null; + + constructor() { + super("client-credentials"); + this.grantType = "client_credentials"; + this.clientId = ""; + this.clientSecret = ""; + this.tokenManager = null; + } + + public toAuthStrategy(): AuthStrategy { + if (this.tokenManager == null) { + this.tokenManager = new OrgsTokenManager({ + grantType: this.grantType, + clientId: this.clientId, + clientSecret: this.clientSecret, + }); + } + return new TokenAuthStrategy(this.tokenManager); + } +} + +namespace OrgsCredentialProvider { + export class OrgsCredentialProviderBuilder { + private readonly instance: OrgsCredentialProvider; + + constructor() { + this.instance = new OrgsCredentialProvider(); + } + + public setClientId(clientId: string): OrgsCredentialProviderBuilder { + this.instance.clientId = clientId; + return this; + } + + public setClientSecret( + clientSecret: string + ): OrgsCredentialProviderBuilder { + this.instance.clientSecret = clientSecret; + return this; + } + + public setTokenManager( + tokenManager: TokenManager + ): OrgsCredentialProviderBuilder { + this.instance.tokenManager = tokenManager; + return this; + } + + public build(): OrgsCredentialProvider { + return this.instance; + } + } +} + +export = OrgsCredentialProvider; diff --git a/src/http/bearer_token/ApiTokenManager.ts b/src/http/bearer_token/ApiTokenManager.ts new file mode 100644 index 0000000000..a6861f074b --- /dev/null +++ b/src/http/bearer_token/ApiTokenManager.ts @@ -0,0 +1,42 @@ +import TokenManager from "./TokenManager"; +import { + TokenListInstance, + TokenListInstanceCreateOptions, +} from "../../rest/previewIam/v1/token"; +import PreviewIamBase from "../../rest/PreviewIamBase"; +import V1 from "../../rest/previewIam/V1"; +import NoAuthCredentialProvider from "../../credential_provider/NoAuthCredentialProvider"; +import { Client } from "../../base/BaseTwilio"; + +export default class ApiTokenManager implements TokenManager { + private params: TokenListInstanceCreateOptions; + + constructor(params: TokenListInstanceCreateOptions) { + this.params = params; + } + + getParams(): TokenListInstanceCreateOptions { + return this.params; + } + + async fetchToken(): Promise { + const noAuthCredentialProvider = + new NoAuthCredentialProvider.NoAuthCredentialProvider(); + const client = new Client(); + client.setCredentialProvider(noAuthCredentialProvider); + + const tokenListInstance = TokenListInstance( + new V1(new PreviewIamBase(client)) + ); + return tokenListInstance + .create(this.params) + .then((token) => { + return token.accessToken; + }) + .catch((error) => { + throw new Error( + `Error Status Code: ${error.status}\nFailed to fetch access token: ${error.message}` + ); + }); + } +} diff --git a/src/http/bearer_token/OrgsTokenManager.ts b/src/http/bearer_token/OrgsTokenManager.ts new file mode 100644 index 0000000000..88da181cf9 --- /dev/null +++ b/src/http/bearer_token/OrgsTokenManager.ts @@ -0,0 +1,42 @@ +import TokenManager from "./TokenManager"; +import { + TokenListInstance, + TokenListInstanceCreateOptions, +} from "../../rest/previewIam/v1/token"; +import PreviewIamBase from "../../rest/PreviewIamBase"; +import V1 from "../../rest/previewIam/V1"; +import NoAuthCredentialProvider from "../../credential_provider/NoAuthCredentialProvider"; +import { Client } from "../../base/BaseTwilio"; + +export default class OrgsTokenManager implements TokenManager { + private readonly params: TokenListInstanceCreateOptions; + + constructor(params: TokenListInstanceCreateOptions) { + this.params = params; + } + + getParams(): TokenListInstanceCreateOptions { + return this.params; + } + + async fetchToken(): Promise { + const noAuthCredentialProvider = + new NoAuthCredentialProvider.NoAuthCredentialProvider(); + const client = new Client(); + client.setCredentialProvider(noAuthCredentialProvider); + + const tokenListInstance = TokenListInstance( + new V1(new PreviewIamBase(client)) + ); + return tokenListInstance + .create(this.params) + .then((token) => { + return token.accessToken; + }) + .catch((error) => { + throw new Error( + `Error Status Code: ${error.status}\nFailed to fetch access token: ${error.message}` + ); + }); + } +} diff --git a/src/http/bearer_token/TokenManager.ts b/src/http/bearer_token/TokenManager.ts new file mode 100644 index 0000000000..4fa904f8c7 --- /dev/null +++ b/src/http/bearer_token/TokenManager.ts @@ -0,0 +1,3 @@ +export default abstract class TokenManager { + abstract fetchToken(): Promise; +} diff --git a/src/index.ts b/src/index.ts index 1d22dba6a4..d3f10b1675 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,9 @@ import * as taskRouterUtil from "./jwt/taskrouter/util"; import IVoiceResponse from "./twiml/VoiceResponse"; import IMessagingResponse from "./twiml/MessagingResponse"; import IFaxResponse from "./twiml/FaxResponse"; +import IClientCredentialProvider from "./credential_provider/ClientCredentialProvider"; +import INoAuthCredentialProvider from "./credential_provider/NoAuthCredentialProvider"; +import IOrgsCredentialProvider from "./credential_provider/OrgsCredentialProvider"; // Shorthand to automatically create a RestClient function TwilioSDK( @@ -44,6 +47,22 @@ namespace TwilioSDK { } export type RequestClient = IRequestClient; export const RequestClient = IRequestClient; + + export type ClientCredentialProviderBuilder = + IClientCredentialProvider.ClientCredentialProviderBuilder; + export const ClientCredentialProviderBuilder = + IClientCredentialProvider.ClientCredentialProviderBuilder; + + export type OrgsCredentialProviderBuilder = + IOrgsCredentialProvider.OrgsCredentialProviderBuilder; + export const OrgsCredentialProviderBuilder = + IOrgsCredentialProvider.OrgsCredentialProviderBuilder; + + export type NoAuthCredentialProvider = + INoAuthCredentialProvider.NoAuthCredentialProvider; + export const NoAuthCredentialProvider = + INoAuthCredentialProvider.NoAuthCredentialProvider; + // Setup webhook helper functionality export type validateBody = typeof webhooks.validateBody; export const validateBody = webhooks.validateBody; diff --git a/src/rest/Preview.ts b/src/rest/Preview.ts index 02f87e9fc4..81a7735e7d 100644 --- a/src/rest/Preview.ts +++ b/src/rest/Preview.ts @@ -1,23 +1,13 @@ -import { FleetListInstance } from "./preview/deployed_devices/fleet"; import { AuthorizationDocumentListInstance } from "./preview/hosted_numbers/authorizationDocument"; import { HostedNumberOrderListInstance } from "./preview/hosted_numbers/hostedNumberOrder"; import { AvailableAddOnListInstance } from "./preview/marketplace/availableAddOn"; import { InstalledAddOnListInstance } from "./preview/marketplace/installedAddOn"; -import { ServiceListInstance } from "./preview/sync/service"; import { CommandListInstance } from "./preview/wireless/command"; import { RatePlanListInstance } from "./preview/wireless/ratePlan"; import { SimListInstance } from "./preview/wireless/sim"; import PreviewBase from "./PreviewBase"; class Preview extends PreviewBase { - /** - * @deprecated - Use deployed_devices.fleets instead - */ - get fleets(): FleetListInstance { - console.warn("fleets is deprecated. Use deployed_devices.fleets instead."); - return this.deployed_devices.fleets; - } - /** * @deprecated - Use hosted_numbers.authorizationDocuments instead */ @@ -58,14 +48,6 @@ class Preview extends PreviewBase { return this.marketplace.installedAddOns; } - /** - * @deprecated - Use sync.services instead - */ - get services(): ServiceListInstance { - console.warn("services is deprecated. Use sync.services instead."); - return this.sync.services; - } - /** * @deprecated - Use wireless.commands instead */ diff --git a/src/rest/PreviewBase.ts b/src/rest/PreviewBase.ts index 2aeead219c..059903ee1b 100644 --- a/src/rest/PreviewBase.ts +++ b/src/rest/PreviewBase.ts @@ -10,14 +10,12 @@ */ import Domain from "../base/Domain"; -import DeployedDevices from "./preview/DeployedDevices"; import HostedNumbers from "./preview/HostedNumbers"; import Sync from "./preview/Sync"; import Marketplace from "./preview/Marketplace"; import Wireless from "./preview/Wireless"; class PreviewBase extends Domain { - _deployed_devices?: DeployedDevices; _hosted_numbers?: HostedNumbers; _sync?: Sync; _marketplace?: Marketplace; @@ -32,11 +30,6 @@ class PreviewBase extends Domain { super(twilio, "https://preview.twilio.com"); } - get deployed_devices(): DeployedDevices { - this._deployed_devices = - this._deployed_devices || new DeployedDevices(this); - return this._deployed_devices; - } get hosted_numbers(): HostedNumbers { this._hosted_numbers = this._hosted_numbers || new HostedNumbers(this); return this._hosted_numbers; diff --git a/src/rest/PreviewIam.ts b/src/rest/PreviewIam.ts new file mode 100644 index 0000000000..1d9ff54d5a --- /dev/null +++ b/src/rest/PreviewIam.ts @@ -0,0 +1,33 @@ +import { TokenListInstance } from "./previewIam/v1/token"; +import { AuthorizeListInstance } from "./previewIam/v1/authorize"; +import PreviewIamBase from "./PreviewIamBase"; +import { OrganizationListInstance } from "./previewIam/versionless/organization"; +import Versionless from "./previewIam/Versionless"; + +class PreviewIam extends PreviewIamBase { + _organization?: OrganizationListInstance; + /** + * @deprecated - Use v1.tokens instead + */ + get tokens(): TokenListInstance { + console.warn("tokens is deprecated. Use v1.tokens instead."); + return this.v1.token; + } + + /** + * @deprecated - Use v1.authorize instead + */ + get authorize(): AuthorizeListInstance { + console.warn("authorize is deprecated. Use v1.authorize instead."); + return this.v1.authorize; + } + + /** Getter for organization resource */ + get organization(): OrganizationListInstance { + this._organization = + this._organization || new Versionless(this).organization; + return this._organization; + } +} + +export = PreviewIam; diff --git a/src/rest/PreviewIamBase.ts b/src/rest/PreviewIamBase.ts new file mode 100644 index 0000000000..b82f1ac98f --- /dev/null +++ b/src/rest/PreviewIamBase.ts @@ -0,0 +1,33 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import Domain from "../base/Domain"; +import V1 from "./previewIam/V1"; + +class PreviewIamBase extends Domain { + _v1?: V1; + + /** + * Initialize previewIam domain + * + * @param twilio - The twilio client + */ + constructor(twilio: any) { + super(twilio, "https://preview-iam.twilio.com"); + } + + get v1(): V1 { + this._v1 = this._v1 || new V1(this); + return this._v1; + } +} + +export = PreviewIamBase; diff --git a/src/rest/Twilio.ts b/src/rest/Twilio.ts index 8031af04aa..a5da6c03db 100644 --- a/src/rest/Twilio.ts +++ b/src/rest/Twilio.ts @@ -20,6 +20,7 @@ import Conversations from "./Conversations"; import Events from "./Events"; import FlexApi from "./FlexApi"; import FrontlineApi from "./FrontlineApi"; +import PreviewIam from "./PreviewIam"; import Iam from "./Iam"; import Insights from "./Insights"; import Intelligence from "./Intelligence"; @@ -99,6 +100,8 @@ class Twilio extends Client { _flexApi?: FlexApi; /** (Twilio.FrontlineApi) - frontlineApi domain */ _frontlineApi?: FrontlineApi; + /** (Twilio.PreviewIam) - previewIam domain */ + _previewIam?: PreviewIam; /** (Twilio.Iam) - iam domain */ _iam?: Iam; /** (Twilio.Insights) - insights domain */ @@ -181,6 +184,7 @@ class Twilio extends Client { this.events; this.flexApi; this.frontlineApi; + this.previewIam; this.iam; this.insights; this.intelligence; @@ -266,6 +270,13 @@ class Twilio extends Client { (this._frontlineApi = new (require("./FrontlineApi"))(this)) ); } + /** Getter for (Twilio.PreviewIam) domain */ + get previewIam(): PreviewIam { + return ( + this._previewIam ?? + (this._previewIam = new (require("./PreviewIam"))(this)) + ); + } /** Getter for (Twilio.Iam) domain */ get iam(): Iam { return this._iam ?? (this._iam = new (require("./Iam"))(this)); diff --git a/src/rest/accounts/V1.ts b/src/rest/accounts/V1.ts index aede0cf6c1..2554275d10 100644 --- a/src/rest/accounts/V1.ts +++ b/src/rest/accounts/V1.ts @@ -15,6 +15,8 @@ import AccountsBase from "../AccountsBase"; import Version from "../../base/Version"; import { AuthTokenPromotionListInstance } from "./v1/authTokenPromotion"; +import { BulkConsentsListInstance } from "./v1/bulkConsents"; +import { BulkContactsListInstance } from "./v1/bulkContacts"; import { CredentialListInstance } from "./v1/credential"; import { SafelistListInstance } from "./v1/safelist"; import { SecondaryAuthTokenListInstance } from "./v1/secondaryAuthToken"; @@ -31,6 +33,10 @@ export default class V1 extends Version { /** authTokenPromotion - { Twilio.Accounts.V1.AuthTokenPromotionListInstance } resource */ protected _authTokenPromotion?: AuthTokenPromotionListInstance; + /** bulkConsents - { Twilio.Accounts.V1.BulkConsentsListInstance } resource */ + protected _bulkConsents?: BulkConsentsListInstance; + /** bulkContacts - { Twilio.Accounts.V1.BulkContactsListInstance } resource */ + protected _bulkContacts?: BulkContactsListInstance; /** credentials - { Twilio.Accounts.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** safelist - { Twilio.Accounts.V1.SafelistListInstance } resource */ @@ -45,6 +51,18 @@ export default class V1 extends Version { return this._authTokenPromotion; } + /** Getter for bulkConsents resource */ + get bulkConsents(): BulkConsentsListInstance { + this._bulkConsents = this._bulkConsents || BulkConsentsListInstance(this); + return this._bulkConsents; + } + + /** Getter for bulkContacts resource */ + get bulkContacts(): BulkContactsListInstance { + this._bulkContacts = this._bulkContacts || BulkContactsListInstance(this); + return this._bulkContacts; + } + /** Getter for credentials resource */ get credentials(): CredentialListInstance { this._credentials = this._credentials || CredentialListInstance(this); diff --git a/src/rest/accounts/v1/authTokenPromotion.ts b/src/rest/accounts/v1/authTokenPromotion.ts index cf77719fdc..bf2d1f5e8b 100644 --- a/src/rest/accounts/v1/authTokenPromotion.ts +++ b/src/rest/accounts/v1/authTokenPromotion.ts @@ -53,11 +53,15 @@ export class AuthTokenPromotionContextImpl update( callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any ): Promise { + 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( diff --git a/src/rest/accounts/v1/bulkConsents.ts b/src/rest/accounts/v1/bulkConsents.ts new file mode 100644 index 0000000000..00564a76b8 --- /dev/null +++ b/src/rest/accounts/v1/bulkConsents.ts @@ -0,0 +1,150 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Accounts + * 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 create a BulkConsentsInstance + */ +export interface BulkConsentsListInstanceCreateOptions { + /** This is a list of objects that describes a contact\\\'s opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]. */ + items: Array; +} + +export interface BulkConsentsSolution {} + +export interface BulkConsentsListInstance { + _version: V1; + _solution: BulkConsentsSolution; + _uri: string; + + /** + * Create a BulkConsentsInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed BulkConsentsInstance + */ + create( + params: BulkConsentsListInstanceCreateOptions, + callback?: (error: Error | null, item?: BulkConsentsInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function BulkConsentsListInstance( + version: V1 +): BulkConsentsListInstance { + const instance = {} as BulkConsentsListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/Consents/Bulk`; + + instance.create = function create( + params: BulkConsentsListInstanceCreateOptions, + callback?: (error: Error | null, items: BulkConsentsInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["items"] === null || params["items"] === undefined) { + throw new Error("Required parameter \"params['items']\" missing."); + } + + let data: any = {}; + + data["Items"] = serialize.map(params["items"], (e: any) => + serialize.object(e) + ); + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new BulkConsentsInstance(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; +} + +interface BulkConsentsPayload extends BulkConsentsResource {} + +interface BulkConsentsResource { + items: any; +} + +export class BulkConsentsInstance { + constructor(protected _version: V1, payload: BulkConsentsResource) { + this.items = payload.items; + } + + /** + * A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + */ + items: any; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + items: this.items, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/accounts/v1/bulkContacts.ts b/src/rest/accounts/v1/bulkContacts.ts new file mode 100644 index 0000000000..c12a7858b2 --- /dev/null +++ b/src/rest/accounts/v1/bulkContacts.ts @@ -0,0 +1,150 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Accounts + * 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 create a BulkContactsInstance + */ +export interface BulkContactsListInstanceCreateOptions { + /** A list of objects where each object represents a contact\\\'s details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. */ + items: Array; +} + +export interface BulkContactsSolution {} + +export interface BulkContactsListInstance { + _version: V1; + _solution: BulkContactsSolution; + _uri: string; + + /** + * Create a BulkContactsInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed BulkContactsInstance + */ + create( + params: BulkContactsListInstanceCreateOptions, + callback?: (error: Error | null, item?: BulkContactsInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function BulkContactsListInstance( + version: V1 +): BulkContactsListInstance { + const instance = {} as BulkContactsListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/Contacts/Bulk`; + + instance.create = function create( + params: BulkContactsListInstanceCreateOptions, + callback?: (error: Error | null, items: BulkContactsInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["items"] === null || params["items"] === undefined) { + throw new Error("Required parameter \"params['items']\" missing."); + } + + let data: any = {}; + + data["Items"] = serialize.map(params["items"], (e: any) => + serialize.object(e) + ); + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new BulkContactsInstance(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; +} + +interface BulkContactsPayload extends BulkContactsResource {} + +interface BulkContactsResource { + items: any; +} + +export class BulkContactsInstance { + constructor(protected _version: V1, payload: BulkContactsResource) { + this.items = payload.items; + } + + /** + * A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + */ + items: any; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + items: this.items, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/accounts/v1/credential/aws.ts b/src/rest/accounts/v1/credential/aws.ts index 73d9663310..4d5e9f73ad 100644 --- a/src/rest/accounts/v1/credential/aws.ts +++ b/src/rest/accounts/v1/credential/aws.ts @@ -148,11 +148,14 @@ export class AwsContextImpl implements AwsContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class AwsContextImpl implements AwsContext { fetch( callback?: (error: Error | null, item?: AwsInstance) => any ): Promise { + 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( @@ -204,6 +211,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, @@ -508,6 +516,7 @@ export function AwsListInstance(version: V1): AwsListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -549,6 +558,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({ diff --git a/src/rest/accounts/v1/credential/publicKey.ts b/src/rest/accounts/v1/credential/publicKey.ts index 42b0b3c48d..d58711ae8d 100644 --- a/src/rest/accounts/v1/credential/publicKey.ts +++ b/src/rest/accounts/v1/credential/publicKey.ts @@ -148,11 +148,14 @@ export class PublicKeyContextImpl implements PublicKeyContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class PublicKeyContextImpl implements PublicKeyContext { fetch( callback?: (error: Error | null, item?: PublicKeyInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class PublicKeyContextImpl implements PublicKeyContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -513,6 +521,7 @@ export function PublicKeyListInstance(version: V1): PublicKeyListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -554,6 +563,7 @@ export function PublicKeyListInstance(version: V1): PublicKeyListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/accounts/v1/safelist.ts b/src/rest/accounts/v1/safelist.ts index f2a784d6db..d18502a6eb 100644 --- a/src/rest/accounts/v1/safelist.ts +++ b/src/rest/accounts/v1/safelist.ts @@ -140,6 +140,7 @@ export function SafelistListInstance(version: V1): SafelistListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -214,6 +215,7 @@ export function SafelistListInstance(version: V1): SafelistListInstance { data["PhoneNumber"] = params["phoneNumber"]; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.fetch({ diff --git a/src/rest/accounts/v1/secondaryAuthToken.ts b/src/rest/accounts/v1/secondaryAuthToken.ts index f99ee56c03..eb19db2782 100644 --- a/src/rest/accounts/v1/secondaryAuthToken.ts +++ b/src/rest/accounts/v1/secondaryAuthToken.ts @@ -64,11 +64,15 @@ export class SecondaryAuthTokenContextImpl create( callback?: (error: Error | null, item?: SecondaryAuthTokenInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", + headers, }); operationPromise = operationPromise.then( @@ -85,11 +89,14 @@ export class SecondaryAuthTokenContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( diff --git a/src/rest/api/v2010/account.ts b/src/rest/api/v2010/account.ts index 5cfb5abece..a58f8ddc2f 100644 --- a/src/rest/api/v2010/account.ts +++ b/src/rest/api/v2010/account.ts @@ -385,11 +385,15 @@ export class AccountContextImpl implements AccountContext { fetch( callback?: (error: Error | null, item?: AccountInstance) => any ): Promise { + 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( @@ -425,6 +429,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, @@ -919,6 +924,7 @@ export function AccountListInstance(version: V2010): AccountListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -963,6 +969,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({ diff --git a/src/rest/api/v2010/account/address.ts b/src/rest/api/v2010/account/address.ts index 0bbd271f93..f938b930fb 100644 --- a/src/rest/api/v2010/account/address.ts +++ b/src/rest/api/v2010/account/address.ts @@ -217,11 +217,14 @@ export class AddressContextImpl implements AddressContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -234,11 +237,15 @@ export class AddressContextImpl implements AddressContext { fetch( callback?: (error: Error | null, item?: AddressInstance) => any ): Promise { + 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( @@ -291,6 +298,7 @@ export class AddressContextImpl implements AddressContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -733,6 +741,7 @@ export function AddressListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -785,6 +794,7 @@ export function AddressListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/address/dependentPhoneNumber.ts b/src/rest/api/v2010/account/address/dependentPhoneNumber.ts index 206a86b7d4..770ef12c54 100644 --- a/src/rest/api/v2010/account/address/dependentPhoneNumber.ts +++ b/src/rest/api/v2010/account/address/dependentPhoneNumber.ts @@ -205,6 +205,7 @@ export function DependentPhoneNumberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/application.ts b/src/rest/api/v2010/account/application.ts index 8df7866686..726af2f1fa 100644 --- a/src/rest/api/v2010/account/application.ts +++ b/src/rest/api/v2010/account/application.ts @@ -215,11 +215,14 @@ export class ApplicationContextImpl implements ApplicationContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -232,11 +235,15 @@ export class ApplicationContextImpl implements ApplicationContext { fetch( callback?: (error: Error | null, item?: ApplicationInstance) => any ): Promise { + 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( @@ -308,6 +315,7 @@ export class ApplicationContextImpl implements ApplicationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -782,6 +790,7 @@ export function ApplicationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -830,6 +839,7 @@ export function ApplicationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/authorizedConnectApp.ts b/src/rest/api/v2010/account/authorizedConnectApp.ts index 208436838f..eb43f7453a 100644 --- a/src/rest/api/v2010/account/authorizedConnectApp.ts +++ b/src/rest/api/v2010/account/authorizedConnectApp.ts @@ -111,11 +111,15 @@ export class AuthorizedConnectAppContextImpl fetch( callback?: (error: Error | null, item?: AuthorizedConnectAppInstance) => any ): Promise { + 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( @@ -413,6 +417,7 @@ export function AuthorizedConnectAppListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry.ts index fc187d2bd3..5594adfd76 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry.ts @@ -215,11 +215,15 @@ export class AvailablePhoneNumberCountryContextImpl item?: AvailablePhoneNumberCountryInstance ) => any ): Promise { + 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( @@ -560,6 +564,7 @@ export function AvailablePhoneNumberCountryListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/local.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/local.ts index 747084aac1..c7e2301595 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/local.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/local.ts @@ -328,6 +328,7 @@ export function LocalListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/machineToMachine.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/machineToMachine.ts index 006790f774..150853c148 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/machineToMachine.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/machineToMachine.ts @@ -337,6 +337,7 @@ export function MachineToMachineListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/mobile.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/mobile.ts index 8678a9971f..6368047ae6 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/mobile.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/mobile.ts @@ -328,6 +328,7 @@ export function MobileListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/national.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/national.ts index 1dbd15ec6f..b1100612eb 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/national.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/national.ts @@ -328,6 +328,7 @@ export function NationalListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/sharedCost.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/sharedCost.ts index 4a7fec5b7d..a2c7000992 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/sharedCost.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/sharedCost.ts @@ -328,6 +328,7 @@ export function SharedCostListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/tollFree.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/tollFree.ts index fcdd512ed4..ffc73aec25 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/tollFree.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/tollFree.ts @@ -328,6 +328,7 @@ export function TollFreeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/availablePhoneNumberCountry/voip.ts b/src/rest/api/v2010/account/availablePhoneNumberCountry/voip.ts index 97283d6ee5..ce7dedaa86 100644 --- a/src/rest/api/v2010/account/availablePhoneNumberCountry/voip.ts +++ b/src/rest/api/v2010/account/availablePhoneNumberCountry/voip.ts @@ -328,6 +328,7 @@ export function VoipListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/balance.ts b/src/rest/api/v2010/account/balance.ts index 5176639cd9..94b005fa3e 100644 --- a/src/rest/api/v2010/account/balance.ts +++ b/src/rest/api/v2010/account/balance.ts @@ -62,10 +62,14 @@ export function BalanceListInstance( instance.fetch = function fetch( callback?: (error: Error | null, items: BalanceInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", + headers, }); operationPromise = operationPromise.then( diff --git a/src/rest/api/v2010/account/call.ts b/src/rest/api/v2010/account/call.ts index 045402243e..86786d5e01 100644 --- a/src/rest/api/v2010/account/call.ts +++ b/src/rest/api/v2010/account/call.ts @@ -434,11 +434,14 @@ export class CallContextImpl implements CallContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -451,11 +454,15 @@ export class CallContextImpl implements CallContext { fetch( callback?: (error: Error | null, item?: CallInstance) => any ): Promise { + 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( @@ -508,6 +515,7 @@ export class CallContextImpl implements CallContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -1109,6 +1117,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({ @@ -1172,6 +1181,7 @@ export function CallListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/call/event.ts b/src/rest/api/v2010/account/call/event.ts index 24196a413c..b0112a7fbb 100644 --- a/src/rest/api/v2010/account/call/event.ts +++ b/src/rest/api/v2010/account/call/event.ts @@ -182,6 +182,7 @@ export function EventListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/call/notification.ts b/src/rest/api/v2010/account/call/notification.ts index 4e993b9376..92aed3be52 100644 --- a/src/rest/api/v2010/account/call/notification.ts +++ b/src/rest/api/v2010/account/call/notification.ts @@ -134,11 +134,15 @@ export class NotificationContextImpl implements NotificationContext { fetch( callback?: (error: Error | null, item?: NotificationInstance) => any ): Promise { + 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( @@ -495,6 +499,7 @@ export function NotificationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/call/payment.ts b/src/rest/api/v2010/account/call/payment.ts index 09e960b8bd..87ff0c9350 100644 --- a/src/rest/api/v2010/account/call/payment.ts +++ b/src/rest/api/v2010/account/call/payment.ts @@ -178,6 +178,7 @@ export class PaymentContextImpl implements PaymentContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -445,6 +446,7 @@ export function PaymentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/call/recording.ts b/src/rest/api/v2010/account/call/recording.ts index f987935695..a58e2538b0 100644 --- a/src/rest/api/v2010/account/call/recording.ts +++ b/src/rest/api/v2010/account/call/recording.ts @@ -196,11 +196,14 @@ export class RecordingContextImpl implements RecordingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -213,11 +216,15 @@ export class RecordingContextImpl implements RecordingContext { fetch( callback?: (error: Error | null, item?: RecordingInstance) => any ): Promise { + 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( @@ -258,6 +265,7 @@ export class RecordingContextImpl implements RecordingContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -684,6 +692,7 @@ export function RecordingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -737,6 +746,7 @@ export function RecordingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/call/siprec.ts b/src/rest/api/v2010/account/call/siprec.ts index 04655fd138..5262bf1796 100644 --- a/src/rest/api/v2010/account/call/siprec.ts +++ b/src/rest/api/v2010/account/call/siprec.ts @@ -515,6 +515,7 @@ export class SiprecContextImpl implements SiprecContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -1159,6 +1160,7 @@ export function SiprecListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/call/stream.ts b/src/rest/api/v2010/account/call/stream.ts index cc1028f882..0c0becec07 100644 --- a/src/rest/api/v2010/account/call/stream.ts +++ b/src/rest/api/v2010/account/call/stream.ts @@ -515,6 +515,7 @@ export class StreamContextImpl implements StreamContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -1147,6 +1148,7 @@ export function StreamListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/call/transcription.ts b/src/rest/api/v2010/account/call/transcription.ts index 23f4620c5e..28aa0abe42 100644 --- a/src/rest/api/v2010/account/call/transcription.ts +++ b/src/rest/api/v2010/account/call/transcription.ts @@ -65,6 +65,8 @@ export interface TranscriptionListInstanceCreateOptions { hints?: string; /** The provider will add punctuation to recognition result */ enableAutomaticPunctuation?: boolean; + /** The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. */ + intelligenceService?: string; } export interface TranscriptionContext { @@ -138,6 +140,7 @@ export class TranscriptionContextImpl implements TranscriptionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -397,9 +400,12 @@ export function TranscriptionListInstance( data["EnableAutomaticPunctuation"] = serialize.bool( params["enableAutomaticPunctuation"] ); + if (params["intelligenceService"] !== undefined) + data["IntelligenceService"] = params["intelligenceService"]; const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/call/userDefinedMessage.ts b/src/rest/api/v2010/account/call/userDefinedMessage.ts index 1a6a714d11..77350cb246 100644 --- a/src/rest/api/v2010/account/call/userDefinedMessage.ts +++ b/src/rest/api/v2010/account/call/userDefinedMessage.ts @@ -97,6 +97,7 @@ export function UserDefinedMessageListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/call/userDefinedMessageSubscription.ts b/src/rest/api/v2010/account/call/userDefinedMessageSubscription.ts index eb58a2d2cc..7e7bf7c20f 100644 --- a/src/rest/api/v2010/account/call/userDefinedMessageSubscription.ts +++ b/src/rest/api/v2010/account/call/userDefinedMessageSubscription.ts @@ -86,11 +86,14 @@ export class UserDefinedMessageSubscriptionContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -300,6 +303,7 @@ export function UserDefinedMessageSubscriptionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/conference.ts b/src/rest/api/v2010/account/conference.ts index 670a54a56e..81e8bdeda3 100644 --- a/src/rest/api/v2010/account/conference.ts +++ b/src/rest/api/v2010/account/conference.ts @@ -223,11 +223,15 @@ export class ConferenceContextImpl implements ConferenceContext { fetch( callback?: (error: Error | null, item?: ConferenceInstance) => any ): Promise { + 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( @@ -270,6 +274,7 @@ export class ConferenceContextImpl implements ConferenceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -636,6 +641,7 @@ export function ConferenceListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/conference/participant.ts b/src/rest/api/v2010/account/conference/participant.ts index 5a1ec9c606..5999a5438a 100644 --- a/src/rest/api/v2010/account/conference/participant.ts +++ b/src/rest/api/v2010/account/conference/participant.ts @@ -301,11 +301,14 @@ export class ParticipantContextImpl implements ParticipantContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -318,11 +321,15 @@ export class ParticipantContextImpl implements ParticipantContext { fetch( callback?: (error: Error | null, item?: ParticipantInstance) => any ): Promise { + 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( @@ -385,6 +392,7 @@ export class ParticipantContextImpl implements ParticipantContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -901,6 +909,7 @@ export function ParticipantListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -954,6 +963,7 @@ export function ParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/conference/recording.ts b/src/rest/api/v2010/account/conference/recording.ts index c99e4d6822..e7c619afd6 100644 --- a/src/rest/api/v2010/account/conference/recording.ts +++ b/src/rest/api/v2010/account/conference/recording.ts @@ -178,11 +178,14 @@ export class RecordingContextImpl implements RecordingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -195,11 +198,15 @@ export class RecordingContextImpl implements RecordingContext { fetch( callback?: (error: Error | null, item?: RecordingInstance) => any ): Promise { + 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( @@ -240,6 +247,7 @@ export class RecordingContextImpl implements RecordingContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -630,6 +638,7 @@ export function RecordingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/connectApp.ts b/src/rest/api/v2010/account/connectApp.ts index b645bf0900..d59fdfab3c 100644 --- a/src/rest/api/v2010/account/connectApp.ts +++ b/src/rest/api/v2010/account/connectApp.ts @@ -157,11 +157,14 @@ export class ConnectAppContextImpl implements ConnectAppContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -174,11 +177,15 @@ export class ConnectAppContextImpl implements ConnectAppContext { fetch( callback?: (error: Error | null, item?: ConnectAppInstance) => any ): Promise { + 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( @@ -235,6 +242,7 @@ export class ConnectAppContextImpl implements ConnectAppContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -584,6 +592,7 @@ export function ConnectAppListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/incomingPhoneNumber.ts b/src/rest/api/v2010/account/incomingPhoneNumber.ts index 62c61166a2..0d3ccf8819 100644 --- a/src/rest/api/v2010/account/incomingPhoneNumber.ts +++ b/src/rest/api/v2010/account/incomingPhoneNumber.ts @@ -306,11 +306,14 @@ export class IncomingPhoneNumberContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -323,11 +326,15 @@ export class IncomingPhoneNumberContextImpl fetch( callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any ): Promise { + 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( @@ -410,6 +417,7 @@ export class IncomingPhoneNumberContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -1031,6 +1039,7 @@ export function IncomingPhoneNumberListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -1084,6 +1093,7 @@ export function IncomingPhoneNumberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.ts b/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.ts index 9a2642000c..3eb9b3628e 100644 --- a/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.ts +++ b/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.ts @@ -145,11 +145,14 @@ export class AssignedAddOnContextImpl implements AssignedAddOnContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class AssignedAddOnContextImpl implements AssignedAddOnContext { fetch( callback?: (error: Error | null, item?: AssignedAddOnInstance) => any ): Promise { + 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( @@ -515,6 +522,7 @@ export function AssignedAddOnListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -562,6 +570,7 @@ export function AssignedAddOnListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.ts b/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.ts index 5927a2fdf9..933b2da479 100644 --- a/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.ts +++ b/src/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.ts @@ -127,11 +127,15 @@ export class AssignedAddOnExtensionContextImpl item?: AssignedAddOnExtensionInstance ) => any ): Promise { + 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( @@ -461,6 +465,7 @@ export function AssignedAddOnExtensionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/incomingPhoneNumber/local.ts b/src/rest/api/v2010/account/incomingPhoneNumber/local.ts index 4e4ab3288c..c507c538c3 100644 --- a/src/rest/api/v2010/account/incomingPhoneNumber/local.ts +++ b/src/rest/api/v2010/account/incomingPhoneNumber/local.ts @@ -319,6 +319,7 @@ export function LocalListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -372,6 +373,7 @@ export function LocalListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/incomingPhoneNumber/mobile.ts b/src/rest/api/v2010/account/incomingPhoneNumber/mobile.ts index a0c0254fde..0f1af28565 100644 --- a/src/rest/api/v2010/account/incomingPhoneNumber/mobile.ts +++ b/src/rest/api/v2010/account/incomingPhoneNumber/mobile.ts @@ -319,6 +319,7 @@ export function MobileListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -372,6 +373,7 @@ export function MobileListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/incomingPhoneNumber/tollFree.ts b/src/rest/api/v2010/account/incomingPhoneNumber/tollFree.ts index 33c2716f70..a5f56b585b 100644 --- a/src/rest/api/v2010/account/incomingPhoneNumber/tollFree.ts +++ b/src/rest/api/v2010/account/incomingPhoneNumber/tollFree.ts @@ -319,6 +319,7 @@ export function TollFreeListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -372,6 +373,7 @@ export function TollFreeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/key.ts b/src/rest/api/v2010/account/key.ts index adc249db4d..4aa50aba10 100644 --- a/src/rest/api/v2010/account/key.ts +++ b/src/rest/api/v2010/account/key.ts @@ -141,11 +141,14 @@ export class KeyContextImpl implements KeyContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -158,11 +161,15 @@ export class KeyContextImpl implements KeyContext { fetch( callback?: (error: Error | null, item?: KeyInstance) => any ): Promise { + 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( @@ -202,6 +209,7 @@ export class KeyContextImpl implements KeyContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -502,6 +510,7 @@ export function KeyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/message.ts b/src/rest/api/v2010/account/message.ts index d21e72cf0c..47e00a4292 100644 --- a/src/rest/api/v2010/account/message.ts +++ b/src/rest/api/v2010/account/message.ts @@ -286,11 +286,14 @@ export class MessageContextImpl implements MessageContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -303,11 +306,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -347,6 +354,7 @@ export class MessageContextImpl implements MessageContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -820,6 +828,7 @@ export function MessageListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -874,6 +883,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/message/feedback.ts b/src/rest/api/v2010/account/message/feedback.ts index 9d8a2ff863..1ef862d4e9 100644 --- a/src/rest/api/v2010/account/message/feedback.ts +++ b/src/rest/api/v2010/account/message/feedback.ts @@ -106,6 +106,7 @@ export function FeedbackListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/message/media.ts b/src/rest/api/v2010/account/message/media.ts index 75e1f81e09..c19e1487b7 100644 --- a/src/rest/api/v2010/account/message/media.ts +++ b/src/rest/api/v2010/account/message/media.ts @@ -139,11 +139,14 @@ export class MediaContextImpl implements MediaContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class MediaContextImpl implements MediaContext { fetch( callback?: (error: Error | null, item?: MediaInstance) => any ): Promise { + 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( @@ -463,6 +470,7 @@ export function MediaListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/newKey.ts b/src/rest/api/v2010/account/newKey.ts index b70e48d447..52898cf8bc 100644 --- a/src/rest/api/v2010/account/newKey.ts +++ b/src/rest/api/v2010/account/newKey.ts @@ -99,6 +99,7 @@ export function NewKeyListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/newSigningKey.ts b/src/rest/api/v2010/account/newSigningKey.ts index f5fbdf0fda..3e89aa7cc4 100644 --- a/src/rest/api/v2010/account/newSigningKey.ts +++ b/src/rest/api/v2010/account/newSigningKey.ts @@ -99,6 +99,7 @@ export function NewSigningKeyListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/notification.ts b/src/rest/api/v2010/account/notification.ts index 7bed19232f..2b3dfe0360 100644 --- a/src/rest/api/v2010/account/notification.ts +++ b/src/rest/api/v2010/account/notification.ts @@ -124,11 +124,15 @@ export class NotificationContextImpl implements NotificationContext { fetch( callback?: (error: Error | null, item?: NotificationInstance) => any ): Promise { + 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( @@ -476,6 +480,7 @@ export function NotificationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/outgoingCallerId.ts b/src/rest/api/v2010/account/outgoingCallerId.ts index 3994401ed6..bd53cdd139 100644 --- a/src/rest/api/v2010/account/outgoingCallerId.ts +++ b/src/rest/api/v2010/account/outgoingCallerId.ts @@ -156,11 +156,14 @@ export class OutgoingCallerIdContextImpl implements OutgoingCallerIdContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -173,11 +176,15 @@ export class OutgoingCallerIdContextImpl implements OutgoingCallerIdContext { fetch( callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any ): Promise { + 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( @@ -217,6 +224,7 @@ export class OutgoingCallerIdContextImpl implements OutgoingCallerIdContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -548,6 +556,7 @@ export function OutgoingCallerIdListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/queue.ts b/src/rest/api/v2010/account/queue.ts index 8701fb1333..9b0fb43382 100644 --- a/src/rest/api/v2010/account/queue.ts +++ b/src/rest/api/v2010/account/queue.ts @@ -169,11 +169,14 @@ export class QueueContextImpl implements QueueContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -186,11 +189,15 @@ export class QueueContextImpl implements QueueContext { fetch( callback?: (error: Error | null, item?: QueueInstance) => any ): Promise { + 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( @@ -231,6 +238,7 @@ export class QueueContextImpl implements QueueContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -587,6 +595,7 @@ export function QueueListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -633,6 +642,7 @@ export function QueueListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/queue/member.ts b/src/rest/api/v2010/account/queue/member.ts index 5ed369ca9e..7c5e626596 100644 --- a/src/rest/api/v2010/account/queue/member.ts +++ b/src/rest/api/v2010/account/queue/member.ts @@ -132,11 +132,15 @@ export class MemberContextImpl implements MemberContext { fetch( callback?: (error: Error | null, item?: MemberInstance) => any ): Promise { + 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( @@ -176,6 +180,7 @@ export class MemberContextImpl implements MemberContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -476,6 +481,7 @@ export function MemberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/recording.ts b/src/rest/api/v2010/account/recording.ts index fd545fcaa1..21431212cc 100644 --- a/src/rest/api/v2010/account/recording.ts +++ b/src/rest/api/v2010/account/recording.ts @@ -214,11 +214,14 @@ export class RecordingContextImpl implements RecordingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -247,6 +250,7 @@ export class RecordingContextImpl implements RecordingContext { data["IncludeSoftDeleted"] = serialize.bool(params["includeSoftDeleted"]); const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -662,6 +666,7 @@ export function RecordingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/recording/addOnResult.ts b/src/rest/api/v2010/account/recording/addOnResult.ts index 91223693b3..029c286ebc 100644 --- a/src/rest/api/v2010/account/recording/addOnResult.ts +++ b/src/rest/api/v2010/account/recording/addOnResult.ts @@ -148,11 +148,14 @@ export class AddOnResultContextImpl implements AddOnResultContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class AddOnResultContextImpl implements AddOnResultContext { fetch( callback?: (error: Error | null, item?: AddOnResultInstance) => any ): Promise { + 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( @@ -487,6 +494,7 @@ export function AddOnResultListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/recording/addOnResult/payload.ts b/src/rest/api/v2010/account/recording/addOnResult/payload.ts index e0ca30823b..b744240164 100644 --- a/src/rest/api/v2010/account/recording/addOnResult/payload.ts +++ b/src/rest/api/v2010/account/recording/addOnResult/payload.ts @@ -145,11 +145,14 @@ export class PayloadContextImpl implements PayloadContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class PayloadContextImpl implements PayloadContext { fetch( callback?: (error: Error | null, item?: PayloadInstance) => any ): Promise { + 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( @@ -514,6 +521,7 @@ export function PayloadListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/recording/addOnResult/payload/data.ts b/src/rest/api/v2010/account/recording/addOnResult/payload/data.ts index 38ac8f205f..cd78203e50 100644 --- a/src/rest/api/v2010/account/recording/addOnResult/payload/data.ts +++ b/src/rest/api/v2010/account/recording/addOnResult/payload/data.ts @@ -78,11 +78,15 @@ export class DataContextImpl implements DataContext { fetch( callback?: (error: Error | null, item?: DataInstance) => any ): Promise { + 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( diff --git a/src/rest/api/v2010/account/recording/transcription.ts b/src/rest/api/v2010/account/recording/transcription.ts index 96a4c59774..784147b58e 100644 --- a/src/rest/api/v2010/account/recording/transcription.ts +++ b/src/rest/api/v2010/account/recording/transcription.ts @@ -123,11 +123,14 @@ export class TranscriptionContextImpl implements TranscriptionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -140,11 +143,15 @@ export class TranscriptionContextImpl implements TranscriptionContext { fetch( callback?: (error: Error | null, item?: TranscriptionInstance) => any ): Promise { + 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( @@ -482,6 +489,7 @@ export function TranscriptionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/shortCode.ts b/src/rest/api/v2010/account/shortCode.ts index b7d7057155..55b240f08b 100644 --- a/src/rest/api/v2010/account/shortCode.ts +++ b/src/rest/api/v2010/account/shortCode.ts @@ -152,11 +152,15 @@ export class ShortCodeContextImpl implements ShortCodeContext { fetch( callback?: (error: Error | null, item?: ShortCodeInstance) => any ): Promise { + 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( @@ -205,6 +209,7 @@ export class ShortCodeContextImpl implements ShortCodeContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -552,6 +557,7 @@ export function ShortCodeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/signingKey.ts b/src/rest/api/v2010/account/signingKey.ts index bee7bad734..d56903ed8b 100644 --- a/src/rest/api/v2010/account/signingKey.ts +++ b/src/rest/api/v2010/account/signingKey.ts @@ -141,11 +141,14 @@ export class SigningKeyContextImpl implements SigningKeyContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -158,11 +161,15 @@ export class SigningKeyContextImpl implements SigningKeyContext { fetch( callback?: (error: Error | null, item?: SigningKeyInstance) => any ): Promise { + 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( @@ -202,6 +209,7 @@ export class SigningKeyContextImpl implements SigningKeyContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -490,6 +498,7 @@ export function SigningKeyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/credentialList.ts b/src/rest/api/v2010/account/sip/credentialList.ts index 7010cd853a..cc99d770cd 100644 --- a/src/rest/api/v2010/account/sip/credentialList.ts +++ b/src/rest/api/v2010/account/sip/credentialList.ts @@ -158,11 +158,14 @@ export class CredentialListContextImpl implements CredentialListContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -175,11 +178,15 @@ export class CredentialListContextImpl implements CredentialListContext { fetch( callback?: (error: Error | null, item?: CredentialListInstance) => any ): Promise { + 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( @@ -220,6 +227,7 @@ export class CredentialListContextImpl implements CredentialListContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -557,6 +565,7 @@ export function CredentialListListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -603,6 +612,7 @@ export function CredentialListListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/credentialList/credential.ts b/src/rest/api/v2010/account/sip/credentialList/credential.ts index adf8ffda07..00510f8462 100644 --- a/src/rest/api/v2010/account/sip/credentialList/credential.ts +++ b/src/rest/api/v2010/account/sip/credentialList/credential.ts @@ -161,11 +161,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -178,11 +181,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -573,6 +581,7 @@ export function CredentialListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -620,6 +629,7 @@ export function CredentialListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/domain.ts b/src/rest/api/v2010/account/sip/domain.ts index 3dd21e8412..12f87ad749 100644 --- a/src/rest/api/v2010/account/sip/domain.ts +++ b/src/rest/api/v2010/account/sip/domain.ts @@ -241,11 +241,14 @@ export class DomainContextImpl implements DomainContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -258,11 +261,15 @@ export class DomainContextImpl implements DomainContext { fetch( callback?: (error: Error | null, item?: DomainInstance) => any ): Promise { + 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( @@ -327,6 +334,7 @@ export class DomainContextImpl implements DomainContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -802,6 +810,7 @@ export function DomainListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -848,6 +857,7 @@ export function DomainListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsCredentialListMapping.ts b/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsCredentialListMapping.ts index c3c96c235e..1528075571 100644 --- a/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsCredentialListMapping.ts +++ b/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsCredentialListMapping.ts @@ -136,11 +136,14 @@ export class AuthCallsCredentialListMappingContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class AuthCallsCredentialListMappingContextImpl item?: AuthCallsCredentialListMappingInstance ) => any ): Promise { + 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( @@ -490,6 +497,7 @@ export function AuthCallsCredentialListMappingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -543,6 +551,7 @@ export function AuthCallsCredentialListMappingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsIpAccessControlListMapping.ts b/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsIpAccessControlListMapping.ts index 15ec17b28a..b2fed94d5c 100644 --- a/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsIpAccessControlListMapping.ts +++ b/src/rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsIpAccessControlListMapping.ts @@ -136,11 +136,14 @@ export class AuthCallsIpAccessControlListMappingContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class AuthCallsIpAccessControlListMappingContextImpl item?: AuthCallsIpAccessControlListMappingInstance ) => any ): Promise { + 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( @@ -491,6 +498,7 @@ export function AuthCallsIpAccessControlListMappingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -544,6 +552,7 @@ export function AuthCallsIpAccessControlListMappingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/domain/authTypes/authTypeRegistrations/authRegistrationsCredentialListMapping.ts b/src/rest/api/v2010/account/sip/domain/authTypes/authTypeRegistrations/authRegistrationsCredentialListMapping.ts index 7d87ca974c..e6f1ba2f8e 100644 --- a/src/rest/api/v2010/account/sip/domain/authTypes/authTypeRegistrations/authRegistrationsCredentialListMapping.ts +++ b/src/rest/api/v2010/account/sip/domain/authTypes/authTypeRegistrations/authRegistrationsCredentialListMapping.ts @@ -136,11 +136,14 @@ export class AuthRegistrationsCredentialListMappingContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class AuthRegistrationsCredentialListMappingContextImpl item?: AuthRegistrationsCredentialListMappingInstance ) => any ): Promise { + 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( @@ -493,6 +500,7 @@ export function AuthRegistrationsCredentialListMappingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -546,6 +554,7 @@ export function AuthRegistrationsCredentialListMappingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/domain/credentialListMapping.ts b/src/rest/api/v2010/account/sip/domain/credentialListMapping.ts index 134d9ef335..52dfd5e5de 100644 --- a/src/rest/api/v2010/account/sip/domain/credentialListMapping.ts +++ b/src/rest/api/v2010/account/sip/domain/credentialListMapping.ts @@ -136,11 +136,14 @@ export class CredentialListMappingContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class CredentialListMappingContextImpl item?: CredentialListMappingInstance ) => any ): Promise { + 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( @@ -495,6 +502,7 @@ export function CredentialListMappingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -542,6 +550,7 @@ export function CredentialListMappingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.ts b/src/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.ts index 15f0e3281e..1dae94f54d 100644 --- a/src/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.ts +++ b/src/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.ts @@ -136,11 +136,14 @@ export class IpAccessControlListMappingContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class IpAccessControlListMappingContextImpl item?: IpAccessControlListMappingInstance ) => any ): Promise { + 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( @@ -504,6 +511,7 @@ export function IpAccessControlListMappingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -554,6 +562,7 @@ export function IpAccessControlListMappingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/ipAccessControlList.ts b/src/rest/api/v2010/account/sip/ipAccessControlList.ts index 86dcbad7f6..439a8c98d1 100644 --- a/src/rest/api/v2010/account/sip/ipAccessControlList.ts +++ b/src/rest/api/v2010/account/sip/ipAccessControlList.ts @@ -160,11 +160,14 @@ export class IpAccessControlListContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -177,11 +180,15 @@ export class IpAccessControlListContextImpl fetch( callback?: (error: Error | null, item?: IpAccessControlListInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class IpAccessControlListContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -566,6 +574,7 @@ export function IpAccessControlListListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -612,6 +621,7 @@ export function IpAccessControlListListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.ts b/src/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.ts index f1bc272cfc..44163e92c0 100644 --- a/src/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.ts +++ b/src/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.ts @@ -167,11 +167,14 @@ export class IpAddressContextImpl implements IpAddressContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -184,11 +187,15 @@ export class IpAddressContextImpl implements IpAddressContext { fetch( callback?: (error: Error | null, item?: IpAddressInstance) => any ): Promise { + 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( @@ -233,6 +240,7 @@ export class IpAddressContextImpl implements IpAddressContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -607,6 +615,7 @@ export function IpAddressListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -654,6 +663,7 @@ export function IpAddressListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/token.ts b/src/rest/api/v2010/account/token.ts index 70f0c9fd35..f365c10b8b 100644 --- a/src/rest/api/v2010/account/token.ts +++ b/src/rest/api/v2010/account/token.ts @@ -105,6 +105,7 @@ export function TokenListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/api/v2010/account/transcription.ts b/src/rest/api/v2010/account/transcription.ts index 52944b7d9c..1fe37689f1 100644 --- a/src/rest/api/v2010/account/transcription.ts +++ b/src/rest/api/v2010/account/transcription.ts @@ -113,11 +113,14 @@ export class TranscriptionContextImpl implements TranscriptionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -130,11 +133,15 @@ export class TranscriptionContextImpl implements TranscriptionContext { fetch( callback?: (error: Error | null, item?: TranscriptionInstance) => any ): Promise { + 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( @@ -463,6 +470,7 @@ export function TranscriptionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage.ts b/src/rest/api/v2010/account/usage.ts index b8a54aeb03..2b8b66ca38 100644 --- a/src/rest/api/v2010/account/usage.ts +++ b/src/rest/api/v2010/account/usage.ts @@ -68,6 +68,8 @@ export type UsageCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" diff --git a/src/rest/api/v2010/account/usage/record.ts b/src/rest/api/v2010/account/usage/record.ts index 2727e640c5..ed01b0f650 100644 --- a/src/rest/api/v2010/account/usage/record.ts +++ b/src/rest/api/v2010/account/usage/record.ts @@ -76,6 +76,8 @@ export type RecordCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -579,6 +581,7 @@ export function RecordListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/allTime.ts b/src/rest/api/v2010/account/usage/record/allTime.ts index e32c57ae8d..35e935b0e3 100644 --- a/src/rest/api/v2010/account/usage/record/allTime.ts +++ b/src/rest/api/v2010/account/usage/record/allTime.ts @@ -68,6 +68,8 @@ export type AllTimeCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function AllTimeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/daily.ts b/src/rest/api/v2010/account/usage/record/daily.ts index 54414f46e2..66d3c04e6d 100644 --- a/src/rest/api/v2010/account/usage/record/daily.ts +++ b/src/rest/api/v2010/account/usage/record/daily.ts @@ -68,6 +68,8 @@ export type DailyCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function DailyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/lastMonth.ts b/src/rest/api/v2010/account/usage/record/lastMonth.ts index 41fde6fa00..d20f57371d 100644 --- a/src/rest/api/v2010/account/usage/record/lastMonth.ts +++ b/src/rest/api/v2010/account/usage/record/lastMonth.ts @@ -68,6 +68,8 @@ export type LastMonthCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function LastMonthListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/monthly.ts b/src/rest/api/v2010/account/usage/record/monthly.ts index c73cfa82fd..49844f746a 100644 --- a/src/rest/api/v2010/account/usage/record/monthly.ts +++ b/src/rest/api/v2010/account/usage/record/monthly.ts @@ -68,6 +68,8 @@ export type MonthlyCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function MonthlyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/thisMonth.ts b/src/rest/api/v2010/account/usage/record/thisMonth.ts index 705cc72c9c..e23c76eb55 100644 --- a/src/rest/api/v2010/account/usage/record/thisMonth.ts +++ b/src/rest/api/v2010/account/usage/record/thisMonth.ts @@ -68,6 +68,8 @@ export type ThisMonthCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function ThisMonthListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/today.ts b/src/rest/api/v2010/account/usage/record/today.ts index 3791f08564..dcf0d16d9c 100644 --- a/src/rest/api/v2010/account/usage/record/today.ts +++ b/src/rest/api/v2010/account/usage/record/today.ts @@ -68,6 +68,8 @@ export type TodayCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function TodayListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/yearly.ts b/src/rest/api/v2010/account/usage/record/yearly.ts index 6386d5a933..a03ebb1427 100644 --- a/src/rest/api/v2010/account/usage/record/yearly.ts +++ b/src/rest/api/v2010/account/usage/record/yearly.ts @@ -68,6 +68,8 @@ export type YearlyCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function YearlyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/record/yesterday.ts b/src/rest/api/v2010/account/usage/record/yesterday.ts index c38c46d0ec..e741f03b88 100644 --- a/src/rest/api/v2010/account/usage/record/yesterday.ts +++ b/src/rest/api/v2010/account/usage/record/yesterday.ts @@ -68,6 +68,8 @@ export type YesterdayCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -458,6 +460,7 @@ export function YesterdayListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/usage/trigger.ts b/src/rest/api/v2010/account/usage/trigger.ts index cb0f931b18..aebd060abb 100644 --- a/src/rest/api/v2010/account/usage/trigger.ts +++ b/src/rest/api/v2010/account/usage/trigger.ts @@ -72,6 +72,8 @@ export type TriggerUsageCategory = | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" + | "ivr-virtual-agent-custom-voices" + | "ivr-virtual-agent-genai" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" @@ -438,11 +440,14 @@ export class TriggerContextImpl implements TriggerContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -455,11 +460,15 @@ export class TriggerContextImpl implements TriggerContext { fetch( callback?: (error: Error | null, item?: TriggerInstance) => any ): Promise { + 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( @@ -503,6 +512,7 @@ export class TriggerContextImpl implements TriggerContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -916,6 +926,7 @@ export function TriggerListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -968,6 +979,7 @@ export function TriggerListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/api/v2010/account/validationRequest.ts b/src/rest/api/v2010/account/validationRequest.ts index ee20c48db3..3ffc6311b7 100644 --- a/src/rest/api/v2010/account/validationRequest.ts +++ b/src/rest/api/v2010/account/validationRequest.ts @@ -107,6 +107,7 @@ export function ValidationRequestListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/assistants/v1/assistant.ts b/src/rest/assistants/v1/assistant.ts index 1e8e97f295..824bbc2b4a 100644 --- a/src/rest/assistants/v1/assistant.ts +++ b/src/rest/assistants/v1/assistant.ts @@ -19,10 +19,13 @@ import V1 from "../V1"; const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; +import { AssistantsKnowledgeListInstance } from "./assistant/assistantsKnowledge"; +import { AssistantsToolListInstance } from "./assistant/assistantsTool"; import { FeedbackListInstance } from "./assistant/feedback"; +import { MessageListInstance } from "./assistant/message"; export class AssistantsV1ServiceCreateAssistantRequest { - "customerAi"?: AssistantsV1ServiceCustomerAi; + "customer_ai"?: AssistantsV1ServiceCustomerAi; /** * The name of the assistant. */ @@ -34,19 +37,19 @@ export class AssistantsV1ServiceCreateAssistantRequest { /** * The personality prompt to be used for assistant. */ - "personalityPrompt"?: string; - "segmentCredential"?: AssistantsV1ServiceSegmentCredential; + "personality_prompt"?: string; + "segment_credential"?: AssistantsV1ServiceSegmentCredential; } export class AssistantsV1ServiceCustomerAi { /** * True if the perception engine is enabled. */ - "perceptionEngineEnabled": boolean; + "perception_engine_enabled": boolean; /** * True if the personalization engine is enabled. */ - "personalizationEngineEnabled": boolean; + "personalization_engine_enabled": boolean; } export class AssistantsV1ServiceKnowledge { @@ -61,11 +64,11 @@ export class AssistantsV1ServiceKnowledge { /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. */ - "accountSid"?: string; + "account_sid"?: string; /** * The details of the knowledge source based on the type. */ - "knowledgeSourceDetails"?: Record; + "knowledge_source_details"?: Record; /** * The name of the knowledge source. */ @@ -78,36 +81,40 @@ export class AssistantsV1ServiceKnowledge { * The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\') */ "type"?: string; + /** + * The url of the knowledge resource. + */ + "url"?: string; /** * The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ - "dateCreated"?: Date; + "date_created"?: Date; /** * The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ - "dateUpdated"?: Date; + "date_updated"?: Date; } export class AssistantsV1ServiceSegmentCredential { /** * The profile API key. */ - "profileApiKey"?: string; + "profile_api_key"?: string; /** * The space ID. */ - "spaceId"?: string; + "space_id"?: string; /** * The write key. */ - "writeKey"?: string; + "write_key"?: string; } export class AssistantsV1ServiceTool { /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. */ - "accountSid"?: string; + "account_sid"?: string; /** * The description of the tool. */ @@ -131,23 +138,27 @@ export class AssistantsV1ServiceTool { /** * The authentication requirement for the tool. */ - "requiresAuth": boolean; + "requires_auth": boolean; /** * The type of the tool. (\'WEBHOOK\') */ "type": string; + /** + * The url of the tool resource. + */ + "url"?: string; /** * The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ - "dateCreated": Date; + "date_created": Date; /** * The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ - "dateUpdated": Date; + "date_updated": Date; } export class AssistantsV1ServiceUpdateAssistantRequest { - "customerAi"?: AssistantsV1ServiceCustomerAi; + "customer_ai"?: AssistantsV1ServiceCustomerAi; /** * The name of the assistant. */ @@ -159,8 +170,8 @@ export class AssistantsV1ServiceUpdateAssistantRequest { /** * The personality prompt to be used for assistant. */ - "personalityPrompt"?: string; - "segmentCredential"?: AssistantsV1ServiceSegmentCredential; + "personality_prompt"?: string; + "segment_credential"?: AssistantsV1ServiceSegmentCredential; } /** @@ -215,7 +226,10 @@ export interface AssistantListInstancePageOptions { } export interface AssistantContext { + assistantsKnowledge: AssistantsKnowledgeListInstance; + assistantsTools: AssistantsToolListInstance; feedbacks: FeedbackListInstance; + messages: MessageListInstance; /** * Remove a AssistantInstance @@ -253,12 +267,14 @@ export interface AssistantContext { * Update a AssistantInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssistantInstance */ update( params: AssistantsV1ServiceUpdateAssistantRequest, + headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any ): Promise; @@ -277,7 +293,10 @@ export class AssistantContextImpl implements AssistantContext { protected _solution: AssistantContextSolution; protected _uri: string; + protected _assistantsKnowledge?: AssistantsKnowledgeListInstance; + protected _assistantsTools?: AssistantsToolListInstance; protected _feedbacks?: FeedbackListInstance; + protected _messages?: MessageListInstance; constructor(protected _version: V1, id: string) { if (!isValidPathParam(id)) { @@ -288,20 +307,43 @@ export class AssistantContextImpl implements AssistantContext { this._uri = `/Assistants/${id}`; } + get assistantsKnowledge(): AssistantsKnowledgeListInstance { + this._assistantsKnowledge = + this._assistantsKnowledge || + AssistantsKnowledgeListInstance(this._version, this._solution.id); + return this._assistantsKnowledge; + } + + get assistantsTools(): AssistantsToolListInstance { + this._assistantsTools = + this._assistantsTools || + AssistantsToolListInstance(this._version, this._solution.id); + return this._assistantsTools; + } + get feedbacks(): FeedbackListInstance { this._feedbacks = this._feedbacks || FeedbackListInstance(this._version, this._solution.id); return this._feedbacks; } + get messages(): MessageListInstance { + this._messages = + this._messages || MessageListInstance(this._version, this._solution.id); + return this._messages; + } + remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -314,11 +356,15 @@ export class AssistantContextImpl implements AssistantContext { fetch( callback?: (error: Error | null, item?: AssistantInstance) => any ): Promise { + 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( @@ -337,6 +383,7 @@ export class AssistantContextImpl implements AssistantContext { params?: | AssistantsV1ServiceUpdateAssistantRequest | ((error: Error | null, item?: AssistantInstance) => any), + headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any ): Promise { if (params instanceof Function) { @@ -350,8 +397,12 @@ export class AssistantContextImpl implements AssistantContext { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -399,6 +450,7 @@ interface AssistantResource { model: string; name: string; owner: string; + url: string; personality_prompt: string; date_created: Date; date_updated: Date; @@ -417,6 +469,7 @@ export class AssistantInstance { this.model = payload.model; this.name = payload.name; this.owner = payload.owner; + this.url = payload.url; this.personalityPrompt = payload.personality_prompt; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); @@ -450,6 +503,10 @@ export class AssistantInstance { * The owner/company of the assistant. */ owner: string; + /** + * The url of the assistant resource. + */ + url: string; /** * The personality prompt to be used for assistant. */ @@ -518,12 +575,14 @@ export class AssistantInstance { * Update a AssistantInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssistantInstance */ update( params: AssistantsV1ServiceUpdateAssistantRequest, + headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any ): Promise; @@ -534,6 +593,20 @@ export class AssistantInstance { return this._proxy.update(params, callback); } + /** + * Access the assistantsKnowledge. + */ + assistantsKnowledge(): AssistantsKnowledgeListInstance { + return this._proxy.assistantsKnowledge; + } + + /** + * Access the assistantsTools. + */ + assistantsTools(): AssistantsToolListInstance { + return this._proxy.assistantsTools; + } + /** * Access the feedbacks. */ @@ -541,6 +614,13 @@ export class AssistantInstance { return this._proxy.feedbacks; } + /** + * Access the messages. + */ + messages(): MessageListInstance { + return this._proxy.messages; + } + /** * Provide a user-friendly representation * @@ -554,6 +634,7 @@ export class AssistantInstance { model: this.model, name: this.name, owner: this.owner, + url: this.url, personalityPrompt: this.personalityPrompt, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, @@ -581,12 +662,14 @@ export interface AssistantListInstance { * Create a AssistantInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssistantInstance */ create( params: AssistantsV1ServiceCreateAssistantRequest, + headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any ): Promise; @@ -679,6 +762,7 @@ export function AssistantListInstance(version: V1): AssistantListInstance { instance.create = function create( params: AssistantsV1ServiceCreateAssistantRequest, + headers?: any, callback?: (error: Error | null, items: AssistantInstance) => any ): Promise { if (params === null || params === undefined) { @@ -689,8 +773,12 @@ export function AssistantListInstance(version: V1): AssistantListInstance { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -732,6 +820,7 @@ export function AssistantListInstance(version: V1): AssistantListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/assistant/assistantsKnowledge.ts b/src/rest/assistants/v1/assistant/assistantsKnowledge.ts new file mode 100644 index 0000000000..ff61ff59b7 --- /dev/null +++ b/src/rest/assistants/v1/assistant/assistantsKnowledge.ts @@ -0,0 +1,566 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; +import Response from "../../../../http/response"; +import V1 from "../../V1"; +const deserialize = require("../../../../base/deserialize"); +const serialize = require("../../../../base/serialize"); +import { isValidPathParam } from "../../../../base/utility"; + +/** + * Options to pass to each + */ +export interface AssistantsKnowledgeListInstanceEachOptions { + /** 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 */ + callback?: ( + item: AssistantsKnowledgeInstance, + done: (err?: Error) => void + ) => void; + /** Function to be called upon completion of streaming */ + done?: Function; + /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to list + */ +export interface AssistantsKnowledgeListInstanceOptions { + /** 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 */ + limit?: number; +} + +/** + * Options to pass to page + */ +export interface AssistantsKnowledgeListInstancePageOptions { + /** 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 */ + pageNumber?: number; + /** PageToken provided by the API */ + pageToken?: string; +} + +export interface AssistantsKnowledgeContext { + /** + * Create a AssistantsKnowledgeInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AssistantsKnowledgeInstance + */ + create( + callback?: (error: Error | null, item?: AssistantsKnowledgeInstance) => any + ): Promise; + + /** + * Remove a AssistantsKnowledgeInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface AssistantsKnowledgeContextSolution { + assistantId: string; + id: string; +} + +export class AssistantsKnowledgeContextImpl + implements AssistantsKnowledgeContext +{ + protected _solution: AssistantsKnowledgeContextSolution; + protected _uri: string; + + constructor(protected _version: V1, assistantId: string, id: string) { + if (!isValidPathParam(assistantId)) { + throw new Error("Parameter 'assistantId' is not valid."); + } + + if (!isValidPathParam(id)) { + throw new Error("Parameter 'id' is not valid."); + } + + this._solution = { assistantId, id }; + this._uri = `/Assistants/${assistantId}/Knowledge/${id}`; + } + + create( + callback?: (error: Error | null, item?: AssistantsKnowledgeInstance) => any + ): Promise { + const headers: any = {}; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new AssistantsKnowledgeInstance( + operationVersion, + payload, + instance._solution.assistantId, + instance._solution.id + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + const headers: any = {}; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.remove({ + uri: instance._uri, + method: "delete", + headers, + }); + + 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 AssistantsKnowledgePayload extends TwilioResponsePayload { + knowledge: AssistantsKnowledgeResource[]; +} + +interface AssistantsKnowledgeResource { + description: string; + id: string; + account_sid: string; + knowledge_source_details: Record; + name: string; + status: string; + type: string; + url: string; + date_created: Date; + date_updated: Date; +} + +export class AssistantsKnowledgeInstance { + protected _solution: AssistantsKnowledgeContextSolution; + protected _context?: AssistantsKnowledgeContext; + + constructor( + protected _version: V1, + payload: AssistantsKnowledgeResource, + assistantId: string, + id?: string + ) { + this.description = payload.description; + this.id = payload.id; + this.accountSid = payload.account_sid; + this.knowledgeSourceDetails = payload.knowledge_source_details; + this.name = payload.name; + this.status = payload.status; + this.type = payload.type; + this.url = payload.url; + this.dateCreated = deserialize.iso8601DateTime(payload.date_created); + this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + + this._solution = { assistantId, id: id || this.id }; + } + + /** + * The type of knowledge source. + */ + description: string; + /** + * The description of knowledge. + */ + id: string; + /** + * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + */ + accountSid: string; + /** + * The details of the knowledge source based on the type. + */ + knowledgeSourceDetails: Record; + /** + * The name of the knowledge source. + */ + name: string; + /** + * The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\') + */ + status: string; + /** + * The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\') + */ + type: string; + /** + * The url of the knowledge resource. + */ + url: string; + /** + * The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + dateCreated: Date; + /** + * The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + dateUpdated: Date; + + private get _proxy(): AssistantsKnowledgeContext { + this._context = + this._context || + new AssistantsKnowledgeContextImpl( + this._version, + this._solution.assistantId, + this._solution.id + ); + return this._context; + } + + /** + * Create a AssistantsKnowledgeInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AssistantsKnowledgeInstance + */ + create( + callback?: (error: Error | null, item?: AssistantsKnowledgeInstance) => any + ): Promise { + return this._proxy.create(callback); + } + + /** + * Remove a AssistantsKnowledgeInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + return this._proxy.remove(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + description: this.description, + id: this.id, + accountSid: this.accountSid, + knowledgeSourceDetails: this.knowledgeSourceDetails, + name: this.name, + status: this.status, + type: this.type, + url: this.url, + dateCreated: this.dateCreated, + dateUpdated: this.dateUpdated, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface AssistantsKnowledgeSolution { + assistantId: string; +} + +export interface AssistantsKnowledgeListInstance { + _version: V1; + _solution: AssistantsKnowledgeSolution; + _uri: string; + + (id: string): AssistantsKnowledgeContext; + get(id: string): AssistantsKnowledgeContext; + + /** + * Streams AssistantsKnowledgeInstance records from the API. + * + * This operation lazily loads records as efficiently as possible until the limit + * is reached. + * + * The results are passed into the callback function, so this operation is memory + * efficient. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AssistantsKnowledgeListInstanceEachOptions } [params] - Options for request + * @param { function } [callback] - Function to process each record + */ + each( + callback?: ( + item: AssistantsKnowledgeInstance, + done: (err?: Error) => void + ) => void + ): void; + each( + params: AssistantsKnowledgeListInstanceEachOptions, + callback?: ( + item: AssistantsKnowledgeInstance, + done: (err?: Error) => void + ) => void + ): void; + /** + * Retrieve a single target page of AssistantsKnowledgeInstance records from the API. + * + * The request is executed immediately. + * + * @param { string } [targetUrl] - API-generated URL for the requested results page + * @param { function } [callback] - Callback to handle list of records + */ + getPage( + targetUrl: string, + callback?: (error: Error | null, items: AssistantsKnowledgePage) => any + ): Promise; + /** + * Lists AssistantsKnowledgeInstance records from the API as a list. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AssistantsKnowledgeListInstanceOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + list( + callback?: ( + error: Error | null, + items: AssistantsKnowledgeInstance[] + ) => any + ): Promise; + list( + params: AssistantsKnowledgeListInstanceOptions, + callback?: ( + error: Error | null, + items: AssistantsKnowledgeInstance[] + ) => any + ): Promise; + /** + * Retrieve a single page of AssistantsKnowledgeInstance records from the API. + * + * The request is executed immediately. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AssistantsKnowledgeListInstancePageOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + page( + callback?: (error: Error | null, items: AssistantsKnowledgePage) => any + ): Promise; + page( + params: AssistantsKnowledgeListInstancePageOptions, + callback?: (error: Error | null, items: AssistantsKnowledgePage) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function AssistantsKnowledgeListInstance( + version: V1, + assistantId: string +): AssistantsKnowledgeListInstance { + if (!isValidPathParam(assistantId)) { + throw new Error("Parameter 'assistantId' is not valid."); + } + + const instance = ((id) => + instance.get(id)) as AssistantsKnowledgeListInstance; + + instance.get = function get(id): AssistantsKnowledgeContext { + return new AssistantsKnowledgeContextImpl(version, assistantId, id); + }; + + instance._version = version; + instance._solution = { assistantId }; + instance._uri = `/Assistants/${assistantId}/Knowledge`; + + instance.page = function page( + params?: + | AssistantsKnowledgeListInstancePageOptions + | ((error: Error | null, items: AssistantsKnowledgePage) => any), + callback?: (error: Error | null, items: AssistantsKnowledgePage) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; + + if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; + if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; + + const headers: any = {}; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.page({ + uri: instance._uri, + method: "get", + params: data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new AssistantsKnowledgePage( + operationVersion, + payload, + instance._solution + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + instance.each = instance._version.each; + instance.list = instance._version.list; + + instance.getPage = function getPage( + targetUrl: string, + callback?: (error: Error | null, items: AssistantsKnowledgePage) => any + ): Promise { + const operationPromise = instance._version._domain.twilio.request({ + method: "get", + uri: targetUrl, + }); + + let pagePromise = operationPromise.then( + (payload) => + new AssistantsKnowledgePage( + instance._version, + payload, + instance._solution + ) + ); + pagePromise = instance._version.setPromiseCallback(pagePromise, callback); + return pagePromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +export class AssistantsKnowledgePage extends Page< + V1, + AssistantsKnowledgePayload, + AssistantsKnowledgeResource, + AssistantsKnowledgeInstance +> { + /** + * Initialize the AssistantsKnowledgePage + * + * @param version - Version of the resource + * @param response - Response from the API + * @param solution - Path solution + */ + constructor( + version: V1, + response: Response, + solution: AssistantsKnowledgeSolution + ) { + super(version, response, solution); + } + + /** + * Build an instance of AssistantsKnowledgeInstance + * + * @param payload - Payload response from the API + */ + getInstance( + payload: AssistantsKnowledgeResource + ): AssistantsKnowledgeInstance { + return new AssistantsKnowledgeInstance( + this._version, + payload, + this._solution.assistantId + ); + } + + [inspect.custom](depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/assistants/v1/assistant/assistantsTool.ts b/src/rest/assistants/v1/assistant/assistantsTool.ts new file mode 100644 index 0000000000..40b62d8e4a --- /dev/null +++ b/src/rest/assistants/v1/assistant/assistantsTool.ts @@ -0,0 +1,554 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; +import Response from "../../../../http/response"; +import V1 from "../../V1"; +const deserialize = require("../../../../base/deserialize"); +const serialize = require("../../../../base/serialize"); +import { isValidPathParam } from "../../../../base/utility"; + +/** + * Options to pass to each + */ +export interface AssistantsToolListInstanceEachOptions { + /** 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 */ + callback?: ( + item: AssistantsToolInstance, + done: (err?: Error) => void + ) => void; + /** Function to be called upon completion of streaming */ + done?: Function; + /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to list + */ +export interface AssistantsToolListInstanceOptions { + /** 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 */ + limit?: number; +} + +/** + * Options to pass to page + */ +export interface AssistantsToolListInstancePageOptions { + /** 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 */ + pageNumber?: number; + /** PageToken provided by the API */ + pageToken?: string; +} + +export interface AssistantsToolContext { + /** + * Create a AssistantsToolInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AssistantsToolInstance + */ + create( + callback?: (error: Error | null, item?: AssistantsToolInstance) => any + ): Promise; + + /** + * Remove a AssistantsToolInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface AssistantsToolContextSolution { + assistantId: string; + id: string; +} + +export class AssistantsToolContextImpl implements AssistantsToolContext { + protected _solution: AssistantsToolContextSolution; + protected _uri: string; + + constructor(protected _version: V1, assistantId: string, id: string) { + if (!isValidPathParam(assistantId)) { + throw new Error("Parameter 'assistantId' is not valid."); + } + + if (!isValidPathParam(id)) { + throw new Error("Parameter 'id' is not valid."); + } + + this._solution = { assistantId, id }; + this._uri = `/Assistants/${assistantId}/Tools/${id}`; + } + + create( + callback?: (error: Error | null, item?: AssistantsToolInstance) => any + ): Promise { + const headers: any = {}; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new AssistantsToolInstance( + operationVersion, + payload, + instance._solution.assistantId, + instance._solution.id + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + const headers: any = {}; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.remove({ + uri: instance._uri, + method: "delete", + headers, + }); + + 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 AssistantsToolPayload extends TwilioResponsePayload { + tools: AssistantsToolResource[]; +} + +interface AssistantsToolResource { + account_sid: string; + description: string; + enabled: boolean; + id: string; + meta: Record; + name: string; + requires_auth: boolean; + type: string; + url: string; + date_created: Date; + date_updated: Date; +} + +export class AssistantsToolInstance { + protected _solution: AssistantsToolContextSolution; + protected _context?: AssistantsToolContext; + + constructor( + protected _version: V1, + payload: AssistantsToolResource, + assistantId: string, + id?: string + ) { + this.accountSid = payload.account_sid; + this.description = payload.description; + this.enabled = payload.enabled; + this.id = payload.id; + this.meta = payload.meta; + this.name = payload.name; + this.requiresAuth = payload.requires_auth; + this.type = payload.type; + this.url = payload.url; + this.dateCreated = deserialize.iso8601DateTime(payload.date_created); + this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + + this._solution = { assistantId, id: id || this.id }; + } + + /** + * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. + */ + accountSid: string; + /** + * The description of the tool. + */ + description: string; + /** + * True if the tool is enabled. + */ + enabled: boolean; + /** + * The tool ID. + */ + id: string; + /** + * The metadata related to method, url, input_schema to used with the Tool. + */ + meta: Record; + /** + * The name of the tool. + */ + name: string; + /** + * The authentication requirement for the tool. + */ + requiresAuth: boolean; + /** + * The type of the tool. (\'WEBHOOK\') + */ + type: string; + /** + * The url of the tool resource. + */ + url: string; + /** + * The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + dateCreated: Date; + /** + * The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + dateUpdated: Date; + + private get _proxy(): AssistantsToolContext { + this._context = + this._context || + new AssistantsToolContextImpl( + this._version, + this._solution.assistantId, + this._solution.id + ); + return this._context; + } + + /** + * Create a AssistantsToolInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AssistantsToolInstance + */ + create( + callback?: (error: Error | null, item?: AssistantsToolInstance) => any + ): Promise { + return this._proxy.create(callback); + } + + /** + * Remove a AssistantsToolInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + return this._proxy.remove(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accountSid: this.accountSid, + description: this.description, + enabled: this.enabled, + id: this.id, + meta: this.meta, + name: this.name, + requiresAuth: this.requiresAuth, + type: this.type, + url: this.url, + dateCreated: this.dateCreated, + dateUpdated: this.dateUpdated, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface AssistantsToolSolution { + assistantId: string; +} + +export interface AssistantsToolListInstance { + _version: V1; + _solution: AssistantsToolSolution; + _uri: string; + + (id: string): AssistantsToolContext; + get(id: string): AssistantsToolContext; + + /** + * Streams AssistantsToolInstance records from the API. + * + * This operation lazily loads records as efficiently as possible until the limit + * is reached. + * + * The results are passed into the callback function, so this operation is memory + * efficient. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AssistantsToolListInstanceEachOptions } [params] - Options for request + * @param { function } [callback] - Function to process each record + */ + each( + callback?: ( + item: AssistantsToolInstance, + done: (err?: Error) => void + ) => void + ): void; + each( + params: AssistantsToolListInstanceEachOptions, + callback?: ( + item: AssistantsToolInstance, + done: (err?: Error) => void + ) => void + ): void; + /** + * Retrieve a single target page of AssistantsToolInstance records from the API. + * + * The request is executed immediately. + * + * @param { string } [targetUrl] - API-generated URL for the requested results page + * @param { function } [callback] - Callback to handle list of records + */ + getPage( + targetUrl: string, + callback?: (error: Error | null, items: AssistantsToolPage) => any + ): Promise; + /** + * Lists AssistantsToolInstance records from the API as a list. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AssistantsToolListInstanceOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + list( + callback?: (error: Error | null, items: AssistantsToolInstance[]) => any + ): Promise; + list( + params: AssistantsToolListInstanceOptions, + callback?: (error: Error | null, items: AssistantsToolInstance[]) => any + ): Promise; + /** + * Retrieve a single page of AssistantsToolInstance records from the API. + * + * The request is executed immediately. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AssistantsToolListInstancePageOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + page( + callback?: (error: Error | null, items: AssistantsToolPage) => any + ): Promise; + page( + params: AssistantsToolListInstancePageOptions, + callback?: (error: Error | null, items: AssistantsToolPage) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function AssistantsToolListInstance( + version: V1, + assistantId: string +): AssistantsToolListInstance { + if (!isValidPathParam(assistantId)) { + throw new Error("Parameter 'assistantId' is not valid."); + } + + const instance = ((id) => instance.get(id)) as AssistantsToolListInstance; + + instance.get = function get(id): AssistantsToolContext { + return new AssistantsToolContextImpl(version, assistantId, id); + }; + + instance._version = version; + instance._solution = { assistantId }; + instance._uri = `/Assistants/${assistantId}/Tools`; + + instance.page = function page( + params?: + | AssistantsToolListInstancePageOptions + | ((error: Error | null, items: AssistantsToolPage) => any), + callback?: (error: Error | null, items: AssistantsToolPage) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; + + if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; + if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; + + const headers: any = {}; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.page({ + uri: instance._uri, + method: "get", + params: data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new AssistantsToolPage(operationVersion, payload, instance._solution) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + instance.each = instance._version.each; + instance.list = instance._version.list; + + instance.getPage = function getPage( + targetUrl: string, + callback?: (error: Error | null, items: AssistantsToolPage) => any + ): Promise { + const operationPromise = instance._version._domain.twilio.request({ + method: "get", + uri: targetUrl, + }); + + let pagePromise = operationPromise.then( + (payload) => + new AssistantsToolPage(instance._version, payload, instance._solution) + ); + pagePromise = instance._version.setPromiseCallback(pagePromise, callback); + return pagePromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +export class AssistantsToolPage extends Page< + V1, + AssistantsToolPayload, + AssistantsToolResource, + AssistantsToolInstance +> { + /** + * Initialize the AssistantsToolPage + * + * @param version - Version of the resource + * @param response - Response from the API + * @param solution - Path solution + */ + constructor( + version: V1, + response: Response, + solution: AssistantsToolSolution + ) { + super(version, response, solution); + } + + /** + * Build an instance of AssistantsToolInstance + * + * @param payload - Payload response from the API + */ + getInstance(payload: AssistantsToolResource): AssistantsToolInstance { + return new AssistantsToolInstance( + this._version, + payload, + this._solution.assistantId + ); + } + + [inspect.custom](depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/assistants/v1/assistant/feedback.ts b/src/rest/assistants/v1/assistant/feedback.ts index 69ac4103f6..d9601d7cf3 100644 --- a/src/rest/assistants/v1/assistant/feedback.ts +++ b/src/rest/assistants/v1/assistant/feedback.ts @@ -24,7 +24,7 @@ export class AssistantsV1ServiceCreateFeedbackRequest { /** * The message ID. */ - "messageId"?: string; + "message_id"?: string; /** * The score to be given(0-1). */ @@ -32,7 +32,7 @@ export class AssistantsV1ServiceCreateFeedbackRequest { /** * The Session ID. */ - "sessionId": string; + "session_id": string; /** * The text to be given as feedback. */ @@ -95,12 +95,14 @@ export interface FeedbackListInstance { * Create a FeedbackInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FeedbackInstance */ create( params: AssistantsV1ServiceCreateFeedbackRequest, + headers?: any, callback?: (error: Error | null, item?: FeedbackInstance) => any ): Promise; @@ -196,6 +198,7 @@ export function FeedbackListInstance( instance.create = function create( params: AssistantsV1ServiceCreateFeedbackRequest, + headers?: any, callback?: (error: Error | null, items: FeedbackInstance) => any ): Promise { if (params === null || params === undefined) { @@ -206,8 +209,12 @@ export function FeedbackListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -250,6 +257,7 @@ export function FeedbackListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/assistant/message.ts b/src/rest/assistants/v1/assistant/message.ts new file mode 100644 index 0000000000..ccd48baf98 --- /dev/null +++ b/src/rest/assistants/v1/assistant/message.ts @@ -0,0 +1,223 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * 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 class AssistantsV1ServiceAssistantSendMessageRequest { + /** + * The unique identity of user for the session. + */ + "identity": string; + /** + * The unique name for the session. + */ + "session_id"?: string; + /** + * The query to ask the assistant. + */ + "body": string; + /** + * The webhook url to call after the assistant has generated a response or report an error. + */ + "webhook"?: string; + /** + * one of the modes \'chat\', \'email\' or \'voice\' + */ + "mode"?: string; +} + +/** + * Options to pass to create a MessageInstance + */ +export interface MessageListInstanceCreateOptions { + /** */ + assistantsV1ServiceAssistantSendMessageRequest: AssistantsV1ServiceAssistantSendMessageRequest; +} + +export interface MessageSolution { + id: string; +} + +export interface MessageListInstance { + _version: V1; + _solution: MessageSolution; + _uri: string; + + /** + * Create a MessageInstance + * + * @param params - Body for request + * @param headers - header params for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed MessageInstance + */ + create( + params: AssistantsV1ServiceAssistantSendMessageRequest, + headers?: any, + callback?: (error: Error | null, item?: MessageInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function MessageListInstance( + version: V1, + id: string +): MessageListInstance { + if (!isValidPathParam(id)) { + throw new Error("Parameter 'id' is not valid."); + } + + const instance = {} as MessageListInstance; + + instance._version = version; + instance._solution = { id }; + instance._uri = `/Assistants/${id}/Messages`; + + instance.create = function create( + params: AssistantsV1ServiceAssistantSendMessageRequest, + headers?: any, + 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; + + if (headers === null || headers === undefined) { + headers = {}; + } + + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new MessageInstance(operationVersion, payload, instance._solution.id) + ); + + 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 MessagePayload extends MessageResource {} + +interface MessageResource { + status: string; + flagged: boolean; + aborted: boolean; + session_id: string; + account_sid: string; + body: string; + error: string; +} + +export class MessageInstance { + constructor(protected _version: V1, payload: MessageResource, id: string) { + this.status = payload.status; + this.flagged = payload.flagged; + this.aborted = payload.aborted; + this.sessionId = payload.session_id; + this.accountSid = payload.account_sid; + this.body = payload.body; + this.error = payload.error; + } + + /** + * success or failure based on whether the request successfully generated a response. + */ + status: string; + /** + * If successful, this property will denote whether the response was flagged or not. + */ + flagged: boolean; + /** + * This property will denote whether the request was aborted or not. + */ + aborted: boolean; + /** + * The unique name for the session. + */ + sessionId: string; + /** + * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the Message. + */ + accountSid: string; + /** + * If successful, the body of the generated response + */ + body: string; + /** + * The error message if generation was not successful + */ + error: string; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + status: this.status, + flagged: this.flagged, + aborted: this.aborted, + sessionId: this.sessionId, + accountSid: this.accountSid, + body: this.body, + error: this.error, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/assistants/v1/knowledge.ts b/src/rest/assistants/v1/knowledge.ts index 75dca21959..9a2554030d 100644 --- a/src/rest/assistants/v1/knowledge.ts +++ b/src/rest/assistants/v1/knowledge.ts @@ -20,12 +20,13 @@ const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; import { ChunkListInstance } from "./knowledge/chunk"; +import { KnowledgeStatusListInstance } from "./knowledge/knowledgeStatus"; export class AssistantsV1ServiceCreateKnowledgeRequest { /** * The Assistant ID. */ - "assistantId"?: string; + "assistant_id"?: string; /** * The description of the knowledge source. */ @@ -33,7 +34,7 @@ export class AssistantsV1ServiceCreateKnowledgeRequest { /** * The details of the knowledge source based on the type. */ - "knowledgeSourceDetails"?: Record; + "knowledge_source_details"?: Record; /** * The name of the tool. */ @@ -58,7 +59,7 @@ export class AssistantsV1ServiceCreatePolicyRequest { * The name of the policy. */ "name"?: string; - "policyDetails": any | null; + "policy_details": any | null; /** * The description of the policy. */ @@ -73,7 +74,7 @@ export class AssistantsV1ServiceUpdateKnowledgeRequest { /** * The details of the knowledge source based on the type. */ - "knowledgeSourceDetails"?: Record; + "knowledge_source_details"?: Record; /** * The name of the knowledge source. */ @@ -144,6 +145,7 @@ export interface KnowledgeListInstancePageOptions { export interface KnowledgeContext { chunks: ChunkListInstance; + knowledgeStatus: KnowledgeStatusListInstance; /** * Remove a KnowledgeInstance @@ -181,12 +183,14 @@ export interface KnowledgeContext { * Update a KnowledgeInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KnowledgeInstance */ update( params: AssistantsV1ServiceUpdateKnowledgeRequest, + headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any ): Promise; @@ -206,6 +210,7 @@ export class KnowledgeContextImpl implements KnowledgeContext { protected _uri: string; protected _chunks?: ChunkListInstance; + protected _knowledgeStatus?: KnowledgeStatusListInstance; constructor(protected _version: V1, id: string) { if (!isValidPathParam(id)) { @@ -222,14 +227,24 @@ export class KnowledgeContextImpl implements KnowledgeContext { return this._chunks; } + get knowledgeStatus(): KnowledgeStatusListInstance { + this._knowledgeStatus = + this._knowledgeStatus || + KnowledgeStatusListInstance(this._version, this._solution.id); + return this._knowledgeStatus; + } + remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -242,11 +257,15 @@ export class KnowledgeContextImpl implements KnowledgeContext { fetch( callback?: (error: Error | null, item?: KnowledgeInstance) => any ): Promise { + 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( @@ -265,6 +284,7 @@ export class KnowledgeContextImpl implements KnowledgeContext { params?: | AssistantsV1ServiceUpdateKnowledgeRequest | ((error: Error | null, item?: KnowledgeInstance) => any), + headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any ): Promise { if (params instanceof Function) { @@ -278,8 +298,12 @@ export class KnowledgeContextImpl implements KnowledgeContext { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -328,6 +352,7 @@ interface KnowledgeResource { name: string; status: string; type: string; + url: string; date_created: Date; date_updated: Date; } @@ -344,6 +369,7 @@ export class KnowledgeInstance { this.name = payload.name; this.status = payload.status; this.type = payload.type; + this.url = payload.url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); @@ -378,6 +404,10 @@ export class KnowledgeInstance { * The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\') */ type: string; + /** + * The url of the knowledge resource. + */ + url: string; /** * The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ @@ -434,12 +464,14 @@ export class KnowledgeInstance { * Update a KnowledgeInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KnowledgeInstance */ update( params: AssistantsV1ServiceUpdateKnowledgeRequest, + headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any ): Promise; @@ -457,6 +489,13 @@ export class KnowledgeInstance { return this._proxy.chunks; } + /** + * Access the knowledgeStatus. + */ + knowledgeStatus(): KnowledgeStatusListInstance { + return this._proxy.knowledgeStatus; + } + /** * Provide a user-friendly representation * @@ -471,6 +510,7 @@ export class KnowledgeInstance { name: this.name, status: this.status, type: this.type, + url: this.url, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; @@ -495,12 +535,14 @@ export interface KnowledgeListInstance { * Create a KnowledgeInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KnowledgeInstance */ create( params: AssistantsV1ServiceCreateKnowledgeRequest, + headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any ): Promise; @@ -593,6 +635,7 @@ export function KnowledgeListInstance(version: V1): KnowledgeListInstance { instance.create = function create( params: AssistantsV1ServiceCreateKnowledgeRequest, + headers?: any, callback?: (error: Error | null, items: KnowledgeInstance) => any ): Promise { if (params === null || params === undefined) { @@ -603,8 +646,12 @@ export function KnowledgeListInstance(version: V1): KnowledgeListInstance { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -648,6 +695,7 @@ export function KnowledgeListInstance(version: V1): KnowledgeListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/knowledge/chunk.ts b/src/rest/assistants/v1/knowledge/chunk.ts index 02e711ed0e..14a07b88b1 100644 --- a/src/rest/assistants/v1/knowledge/chunk.ts +++ b/src/rest/assistants/v1/knowledge/chunk.ts @@ -173,6 +173,7 @@ export function ChunkListInstance(version: V1, id: string): ChunkListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/knowledge/knowledgeStatus.ts b/src/rest/assistants/v1/knowledge/knowledgeStatus.ts new file mode 100644 index 0000000000..66d8006cff --- /dev/null +++ b/src/rest/assistants/v1/knowledge/knowledgeStatus.ts @@ -0,0 +1,232 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * 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 KnowledgeStatusContext { + /** + * Fetch a KnowledgeStatusInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed KnowledgeStatusInstance + */ + fetch( + callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface KnowledgeStatusContextSolution { + id: string; +} + +export class KnowledgeStatusContextImpl implements KnowledgeStatusContext { + protected _solution: KnowledgeStatusContextSolution; + protected _uri: string; + + constructor(protected _version: V1, id: string) { + if (!isValidPathParam(id)) { + throw new Error("Parameter 'id' is not valid."); + } + + this._solution = { id }; + this._uri = `/Knowledge/${id}/Status`; + } + + fetch( + callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any + ): Promise { + 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( + (payload) => + new KnowledgeStatusInstance( + operationVersion, + payload, + instance._solution.id + ) + ); + + 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 KnowledgeStatusPayload extends KnowledgeStatusResource {} + +interface KnowledgeStatusResource { + account_sid: string; + status: string; + last_status: string; + date_updated: Date; +} + +export class KnowledgeStatusInstance { + protected _solution: KnowledgeStatusContextSolution; + protected _context?: KnowledgeStatusContext; + + constructor( + protected _version: V1, + payload: KnowledgeStatusResource, + id: string + ) { + this.accountSid = payload.account_sid; + this.status = payload.status; + this.lastStatus = payload.last_status; + this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + + this._solution = { id }; + } + + /** + * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + */ + accountSid: string; + /** + * The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\') + */ + status: string; + /** + * The last status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\') + */ + lastStatus: string; + /** + * The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + dateUpdated: Date; + + private get _proxy(): KnowledgeStatusContext { + this._context = + this._context || + new KnowledgeStatusContextImpl(this._version, this._solution.id); + return this._context; + } + + /** + * Fetch a KnowledgeStatusInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed KnowledgeStatusInstance + */ + fetch( + callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any + ): Promise { + return this._proxy.fetch(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accountSid: this.accountSid, + status: this.status, + lastStatus: this.lastStatus, + dateUpdated: this.dateUpdated, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface KnowledgeStatusSolution { + id: string; +} + +export interface KnowledgeStatusListInstance { + _version: V1; + _solution: KnowledgeStatusSolution; + _uri: string; + + (): KnowledgeStatusContext; + get(): KnowledgeStatusContext; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function KnowledgeStatusListInstance( + version: V1, + id: string +): KnowledgeStatusListInstance { + if (!isValidPathParam(id)) { + throw new Error("Parameter 'id' is not valid."); + } + + const instance = (() => instance.get()) as KnowledgeStatusListInstance; + + instance.get = function get(): KnowledgeStatusContext { + return new KnowledgeStatusContextImpl(version, id); + }; + + instance._version = version; + instance._solution = { id }; + instance._uri = ``; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} diff --git a/src/rest/assistants/v1/policy.ts b/src/rest/assistants/v1/policy.ts index 9ec20669a9..ca2d2b9866 100644 --- a/src/rest/assistants/v1/policy.ts +++ b/src/rest/assistants/v1/policy.ts @@ -182,6 +182,7 @@ export function PolicyListInstance(version: V1): PolicyListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/session.ts b/src/rest/assistants/v1/session.ts index 8e98f8df6d..3c2cb97413 100644 --- a/src/rest/assistants/v1/session.ts +++ b/src/rest/assistants/v1/session.ts @@ -106,11 +106,15 @@ export class SessionContextImpl implements SessionContext { fetch( callback?: (error: Error | null, item?: SessionInstance) => any ): Promise { + 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( @@ -364,6 +368,7 @@ export function SessionListInstance(version: V1): SessionListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/session/message.ts b/src/rest/assistants/v1/session/message.ts index 9d56bcc4a5..824400a0bb 100644 --- a/src/rest/assistants/v1/session/message.ts +++ b/src/rest/assistants/v1/session/message.ts @@ -176,6 +176,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/assistants/v1/tool.ts b/src/rest/assistants/v1/tool.ts index 20a96fc305..24a13cb129 100644 --- a/src/rest/assistants/v1/tool.ts +++ b/src/rest/assistants/v1/tool.ts @@ -33,7 +33,7 @@ export class AssistantsV1ServiceCreatePolicyRequest { * The name of the policy. */ "name"?: string; - "policyDetails": any | null; + "policy_details": any | null; /** * The description of the policy. */ @@ -44,7 +44,7 @@ export class AssistantsV1ServiceCreateToolRequest { /** * The Assistant ID. */ - "assistantId"?: string; + "assistant_id"?: string; /** * The description of the tool. */ @@ -68,11 +68,50 @@ export class AssistantsV1ServiceCreateToolRequest { "type": string; } +export class AssistantsV1ServicePolicy { + /** + * The Policy ID. + */ + "id"?: string; + /** + * The name of the policy. + */ + "name"?: string; + /** + * The description of the policy. + */ + "description"?: string; + /** + * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Policy resource. + */ + "account_sid"?: string; + /** + * The SID of the User that created the Policy resource. + */ + "user_sid"?: string; + /** + * The type of the policy. + */ + "type": string; + /** + * The details of the policy based on the type. + */ + "policy_details": Record; + /** + * The date and time in GMT when the Policy was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + "date_created"?: Date; + /** + * The date and time in GMT when the Policy was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + "date_updated"?: Date; +} + export class AssistantsV1ServiceUpdateToolRequest { /** * The Assistant ID. */ - "assistantId"?: string; + "assistant_id"?: string; /** * The description of the tool. */ @@ -165,6 +204,17 @@ export interface ToolContext { callback?: (error: Error | null, item?: boolean) => any ): Promise; + /** + * Fetch a ToolInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ToolInstance + */ + fetch( + callback?: (error: Error | null, item?: ToolInstance) => any + ): Promise; + /** * Update a ToolInstance * @@ -179,12 +229,14 @@ export interface ToolContext { * Update a ToolInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ToolInstance */ update( params: AssistantsV1ServiceUpdateToolRequest, + headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any ): Promise; @@ -215,13 +267,42 @@ export class ToolContextImpl implements ToolContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, + }); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + fetch( + callback?: (error: Error | null, item?: ToolInstance) => any + ): Promise { + 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( + (payload) => + new ToolInstance(operationVersion, payload, instance._solution.id) + ); + operationPromise = instance._version.setPromiseCallback( operationPromise, callback @@ -233,6 +314,7 @@ export class ToolContextImpl implements ToolContext { params?: | AssistantsV1ServiceUpdateToolRequest | ((error: Error | null, item?: ToolInstance) => any), + headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any ): Promise { if (params instanceof Function) { @@ -246,8 +328,12 @@ export class ToolContextImpl implements ToolContext { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -297,8 +383,10 @@ interface ToolResource { name: string; requires_auth: boolean; type: string; + url: string; date_created: Date; date_updated: Date; + policies: Array; } export class ToolInstance { @@ -314,8 +402,10 @@ export class ToolInstance { this.name = payload.name; this.requiresAuth = payload.requires_auth; this.type = payload.type; + this.url = payload.url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + this.policies = payload.policies; this._solution = { id: id || this.id }; } @@ -352,6 +442,10 @@ export class ToolInstance { * The type of the tool. (\'WEBHOOK\') */ type: string; + /** + * The url of the tool resource. + */ + url: string; /** * The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ @@ -360,6 +454,10 @@ export class ToolInstance { * The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; + /** + * The Policies associated with the tool. + */ + policies: Array; private get _proxy(): ToolContext { this._context = @@ -380,6 +478,19 @@ export class ToolInstance { return this._proxy.remove(callback); } + /** + * Fetch a ToolInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ToolInstance + */ + fetch( + callback?: (error: Error | null, item?: ToolInstance) => any + ): Promise { + return this._proxy.fetch(callback); + } + /** * Update a ToolInstance * @@ -394,12 +505,14 @@ export class ToolInstance { * Update a ToolInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ToolInstance */ update( params: AssistantsV1ServiceUpdateToolRequest, + headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any ): Promise; @@ -425,8 +538,10 @@ export class ToolInstance { name: this.name, requiresAuth: this.requiresAuth, type: this.type, + url: this.url, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, + policies: this.policies, }; } @@ -449,12 +564,14 @@ export interface ToolListInstance { * Create a ToolInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ToolInstance */ create( params: AssistantsV1ServiceCreateToolRequest, + headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any ): Promise; @@ -547,6 +664,7 @@ export function ToolListInstance(version: V1): ToolListInstance { instance.create = function create( params: AssistantsV1ServiceCreateToolRequest, + headers?: any, callback?: (error: Error | null, items: ToolInstance) => any ): Promise { if (params === null || params === undefined) { @@ -557,8 +675,12 @@ export function ToolListInstance(version: V1): ToolListInstance { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -602,6 +724,7 @@ export function ToolListInstance(version: V1): ToolListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/bulkexports/v1/export.ts b/src/rest/bulkexports/v1/export.ts index a34eaaaa50..7bb684a7dd 100644 --- a/src/rest/bulkexports/v1/export.ts +++ b/src/rest/bulkexports/v1/export.ts @@ -79,11 +79,15 @@ export class ExportContextImpl implements ExportContext { fetch( callback?: (error: Error | null, item?: ExportInstance) => any ): Promise { + 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( diff --git a/src/rest/bulkexports/v1/export/day.ts b/src/rest/bulkexports/v1/export/day.ts index e7850cea66..fb5938f055 100644 --- a/src/rest/bulkexports/v1/export/day.ts +++ b/src/rest/bulkexports/v1/export/day.ts @@ -100,11 +100,15 @@ export class DayContextImpl implements DayContext { fetch( callback?: (error: Error | null, item?: DayInstance) => any ): Promise { + 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( @@ -365,6 +369,7 @@ export function DayListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/bulkexports/v1/export/exportCustomJob.ts b/src/rest/bulkexports/v1/export/exportCustomJob.ts index a5eff26fff..74ad6b997c 100644 --- a/src/rest/bulkexports/v1/export/exportCustomJob.ts +++ b/src/rest/bulkexports/v1/export/exportCustomJob.ts @@ -232,6 +232,7 @@ export function ExportCustomJobListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -278,6 +279,7 @@ export function ExportCustomJobListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/bulkexports/v1/export/job.ts b/src/rest/bulkexports/v1/export/job.ts index 247b41d2c7..599a5558b5 100644 --- a/src/rest/bulkexports/v1/export/job.ts +++ b/src/rest/bulkexports/v1/export/job.ts @@ -68,11 +68,14 @@ export class JobContextImpl implements JobContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -85,11 +88,15 @@ export class JobContextImpl implements JobContext { fetch( callback?: (error: Error | null, item?: JobInstance) => any ): Promise { + 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( diff --git a/src/rest/bulkexports/v1/exportConfiguration.ts b/src/rest/bulkexports/v1/exportConfiguration.ts index d4c3c8622d..4b869b5e8d 100644 --- a/src/rest/bulkexports/v1/exportConfiguration.ts +++ b/src/rest/bulkexports/v1/exportConfiguration.ts @@ -94,11 +94,15 @@ export class ExportConfigurationContextImpl fetch( callback?: (error: Error | null, item?: ExportConfigurationInstance) => any ): Promise { + 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( @@ -141,6 +145,7 @@ export class ExportConfigurationContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/chat/v1/credential.ts b/src/rest/chat/v1/credential.ts index ec5f31c03d..46312768a7 100644 --- a/src/rest/chat/v1/credential.ts +++ b/src/rest/chat/v1/credential.ts @@ -168,11 +168,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -566,6 +574,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -607,6 +616,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service.ts b/src/rest/chat/v1/service.ts index a71155973c..023ca09190 100644 --- a/src/rest/chat/v1/service.ts +++ b/src/rest/chat/v1/service.ts @@ -279,11 +279,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -296,11 +299,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -486,6 +493,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -921,6 +929,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -962,6 +971,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/channel.ts b/src/rest/chat/v1/service/channel.ts index d639e7b0aa..004e23b474 100644 --- a/src/rest/chat/v1/service/channel.ts +++ b/src/rest/chat/v1/service/channel.ts @@ -211,11 +211,14 @@ export class ChannelContextImpl implements ChannelContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -228,11 +231,15 @@ export class ChannelContextImpl implements ChannelContext { fetch( callback?: (error: Error | null, item?: ChannelInstance) => any ): Promise { + 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( @@ -276,6 +283,7 @@ export class ChannelContextImpl implements ChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -691,6 +699,7 @@ export function ChannelListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -742,6 +751,7 @@ export function ChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/channel/invite.ts b/src/rest/chat/v1/service/channel/invite.ts index d8f2fd5225..da419c4c44 100644 --- a/src/rest/chat/v1/service/channel/invite.ts +++ b/src/rest/chat/v1/service/channel/invite.ts @@ -136,11 +136,14 @@ export class InviteContextImpl implements InviteContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -153,11 +156,15 @@ export class InviteContextImpl implements InviteContext { fetch( callback?: (error: Error | null, item?: InviteInstance) => any ): Promise { + 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( @@ -482,6 +489,7 @@ export function InviteListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -531,6 +539,7 @@ export function InviteListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/channel/member.ts b/src/rest/chat/v1/service/channel/member.ts index c2b5084066..b517dbd6ff 100644 --- a/src/rest/chat/v1/service/channel/member.ts +++ b/src/rest/chat/v1/service/channel/member.ts @@ -169,11 +169,14 @@ export class MemberContextImpl implements MemberContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -186,11 +189,15 @@ export class MemberContextImpl implements MemberContext { fetch( callback?: (error: Error | null, item?: MemberInstance) => any ): Promise { + 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( @@ -232,6 +239,7 @@ export class MemberContextImpl implements MemberContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -605,6 +613,7 @@ export function MemberListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -654,6 +663,7 @@ export function MemberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/channel/message.ts b/src/rest/chat/v1/service/channel/message.ts index e02134a132..0fbaf6a065 100644 --- a/src/rest/chat/v1/service/channel/message.ts +++ b/src/rest/chat/v1/service/channel/message.ts @@ -173,11 +173,14 @@ export class MessageContextImpl implements MessageContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -190,11 +193,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class MessageContextImpl implements MessageContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -621,6 +629,7 @@ export function MessageListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -669,6 +678,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/role.ts b/src/rest/chat/v1/service/role.ts index 0499bc9462..ec72bcfd3b 100644 --- a/src/rest/chat/v1/service/role.ts +++ b/src/rest/chat/v1/service/role.ts @@ -145,11 +145,14 @@ export class RoleContextImpl implements RoleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class RoleContextImpl implements RoleContext { fetch( callback?: (error: Error | null, item?: RoleInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class RoleContextImpl implements RoleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -551,6 +559,7 @@ export function RoleListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -597,6 +606,7 @@ export function RoleListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/user.ts b/src/rest/chat/v1/service/user.ts index 71927be25a..c6fcd05c32 100644 --- a/src/rest/chat/v1/service/user.ts +++ b/src/rest/chat/v1/service/user.ts @@ -175,11 +175,14 @@ export class UserContextImpl implements UserContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -192,11 +195,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -239,6 +246,7 @@ export class UserContextImpl implements UserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -633,6 +641,7 @@ export function UserListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -679,6 +688,7 @@ export function UserListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v1/service/user/userChannel.ts b/src/rest/chat/v1/service/user/userChannel.ts index fff619a2b1..410c5fd469 100644 --- a/src/rest/chat/v1/service/user/userChannel.ts +++ b/src/rest/chat/v1/service/user/userChannel.ts @@ -187,6 +187,7 @@ export function UserChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/credential.ts b/src/rest/chat/v2/credential.ts index 2a00989633..b5edefbb86 100644 --- a/src/rest/chat/v2/credential.ts +++ b/src/rest/chat/v2/credential.ts @@ -168,11 +168,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -566,6 +574,7 @@ export function CredentialListInstance(version: V2): CredentialListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -607,6 +616,7 @@ export function CredentialListInstance(version: V2): CredentialListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service.ts b/src/rest/chat/v2/service.ts index 9f06bac58d..0fddb09d1b 100644 --- a/src/rest/chat/v2/service.ts +++ b/src/rest/chat/v2/service.ts @@ -242,11 +242,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -259,11 +262,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -384,6 +391,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -844,6 +852,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -885,6 +894,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/binding.ts b/src/rest/chat/v2/service/binding.ts index 79b3ed2226..a7a5f43d52 100644 --- a/src/rest/chat/v2/service/binding.ts +++ b/src/rest/chat/v2/service/binding.ts @@ -125,11 +125,14 @@ export class BindingContextImpl implements BindingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -142,11 +145,15 @@ export class BindingContextImpl implements BindingContext { fetch( callback?: (error: Error | null, item?: BindingInstance) => any ): Promise { + 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( @@ -469,6 +476,7 @@ export function BindingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/channel.ts b/src/rest/chat/v2/service/channel.ts index 9f205d865e..9bdf394624 100644 --- a/src/rest/chat/v2/service/channel.ts +++ b/src/rest/chat/v2/service/channel.ts @@ -298,11 +298,15 @@ export class ChannelContextImpl implements ChannelContext { fetch( callback?: (error: Error | null, item?: ChannelInstance) => any ): Promise { + 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( @@ -352,6 +356,7 @@ export class ChannelContextImpl implements ChannelContext { 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"]; @@ -799,6 +804,7 @@ export function ChannelListInstance( 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"]; @@ -852,6 +858,7 @@ export function ChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/channel/invite.ts b/src/rest/chat/v2/service/channel/invite.ts index b37ca549b3..96b8bb7bc8 100644 --- a/src/rest/chat/v2/service/channel/invite.ts +++ b/src/rest/chat/v2/service/channel/invite.ts @@ -136,11 +136,14 @@ export class InviteContextImpl implements InviteContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -153,11 +156,15 @@ export class InviteContextImpl implements InviteContext { fetch( callback?: (error: Error | null, item?: InviteInstance) => any ): Promise { + 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( @@ -482,6 +489,7 @@ export function InviteListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -531,6 +539,7 @@ export function InviteListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/channel/member.ts b/src/rest/chat/v2/service/channel/member.ts index 74e67f8d12..40f72947de 100644 --- a/src/rest/chat/v2/service/channel/member.ts +++ b/src/rest/chat/v2/service/channel/member.ts @@ -248,11 +248,15 @@ export class MemberContextImpl implements MemberContext { fetch( callback?: (error: Error | null, item?: MemberInstance) => any ): Promise { + 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( @@ -304,6 +308,7 @@ export class MemberContextImpl implements MemberContext { 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"]; @@ -715,6 +720,7 @@ export function MemberListInstance( 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"]; @@ -766,6 +772,7 @@ export function MemberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/channel/message.ts b/src/rest/chat/v2/service/channel/message.ts index 7a6449c636..e14658621c 100644 --- a/src/rest/chat/v2/service/channel/message.ts +++ b/src/rest/chat/v2/service/channel/message.ts @@ -250,11 +250,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -303,6 +307,7 @@ export class MessageContextImpl implements MessageContext { 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"]; @@ -746,6 +751,7 @@ export function MessageListInstance( 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"]; @@ -796,6 +802,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/channel/webhook.ts b/src/rest/chat/v2/service/channel/webhook.ts index 84dd39dcbd..41c882d051 100644 --- a/src/rest/chat/v2/service/channel/webhook.ts +++ b/src/rest/chat/v2/service/channel/webhook.ts @@ -185,11 +185,14 @@ export class WebhookContextImpl implements WebhookContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -202,11 +205,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -263,6 +270,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -635,6 +643,7 @@ export function WebhookListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -682,6 +691,7 @@ export function WebhookListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/role.ts b/src/rest/chat/v2/service/role.ts index a6c5739c05..cc126ce572 100644 --- a/src/rest/chat/v2/service/role.ts +++ b/src/rest/chat/v2/service/role.ts @@ -145,11 +145,14 @@ export class RoleContextImpl implements RoleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class RoleContextImpl implements RoleContext { fetch( callback?: (error: Error | null, item?: RoleInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class RoleContextImpl implements RoleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -551,6 +559,7 @@ export function RoleListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -597,6 +606,7 @@ export function RoleListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/user.ts b/src/rest/chat/v2/service/user.ts index 33d65b1c29..cd76015023 100644 --- a/src/rest/chat/v2/service/user.ts +++ b/src/rest/chat/v2/service/user.ts @@ -195,11 +195,14 @@ export class UserContextImpl implements UserContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -212,11 +215,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -259,6 +266,7 @@ export class UserContextImpl implements UserContext { 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"]; @@ -662,6 +670,7 @@ export function UserListInstance( 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"]; @@ -710,6 +719,7 @@ export function UserListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/user/userBinding.ts b/src/rest/chat/v2/service/user/userBinding.ts index e72fe78eac..bfd8917111 100644 --- a/src/rest/chat/v2/service/user/userBinding.ts +++ b/src/rest/chat/v2/service/user/userBinding.ts @@ -129,11 +129,14 @@ export class UserBindingContextImpl implements UserBindingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -146,11 +149,15 @@ export class UserBindingContextImpl implements UserBindingContext { fetch( callback?: (error: Error | null, item?: UserBindingInstance) => any ): Promise { + 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( @@ -480,6 +487,7 @@ export function UserBindingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v2/service/user/userChannel.ts b/src/rest/chat/v2/service/user/userChannel.ts index 98c7a8b0fa..d80b519bef 100644 --- a/src/rest/chat/v2/service/user/userChannel.ts +++ b/src/rest/chat/v2/service/user/userChannel.ts @@ -219,11 +219,15 @@ export class UserChannelContextImpl implements UserChannelContext { fetch( callback?: (error: Error | null, item?: UserChannelInstance) => any ): Promise { + 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( @@ -270,6 +274,7 @@ export class UserChannelContextImpl implements UserChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -648,6 +653,7 @@ export function UserChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/chat/v3/channel.ts b/src/rest/chat/v3/channel.ts index be4ee609da..f02494598e 100644 --- a/src/rest/chat/v3/channel.ts +++ b/src/rest/chat/v3/channel.ts @@ -108,6 +108,7 @@ export class ChannelContextImpl implements ChannelContext { 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"]; diff --git a/src/rest/content/v1/content.ts b/src/rest/content/v1/content.ts index 4fa9e4c5fb..25f2835cca 100644 --- a/src/rest/content/v1/content.ts +++ b/src/rest/content/v1/content.ts @@ -24,7 +24,7 @@ import { ApprovalFetchListInstance } from "./content/approvalFetch"; export class AuthenticationAction { "type": AuthenticationActionType; - "copyCodeText": string; + "copy_code_text": string; } export type AuthenticationActionType = "COPY_CODE"; @@ -41,7 +41,8 @@ export type CallToActionActionType = | "URL" | "PHONE_NUMBER" | "COPY_CODE" - | "VOICE_CALL"; + | "VOICE_CALL" + | "VOICE_CALL_REQUEST"; export class CardAction { "type": CardActionType; @@ -78,9 +79,9 @@ export class CarouselCard { export class CatalogItem { "id"?: string; - "sectionTitle"?: string; + "section_title"?: string; "name"?: string; - "mediaUrl"?: string; + "media_url"?: string; "price"?: number; "description"?: string; } @@ -92,7 +93,7 @@ export class ContentCreateRequest { /** * User defined name of the content */ - "friendlyName"?: string; + "friendly_name"?: string; /** * Key value pairs of variable name to value */ @@ -106,7 +107,7 @@ export class ContentCreateRequest { export class FlowsPage { "id": string; - "nextPageId"?: string; + "next_page_id"?: string; "title"?: string; "subtitle"?: string; "layout": Array; @@ -173,7 +174,7 @@ export class TwilioCatalog { "subtitle"?: string; "id"?: string; "items"?: Array; - "dynamicItems"?: string; + "dynamic_items"?: string; } /** @@ -181,9 +182,9 @@ export class TwilioCatalog { */ export class TwilioFlows { "body": string; - "buttonText": string; + "button_text": string; "subtitle": string; - "mediaUrl": string; + "media_url": string; "pages": Array; "type": string; } @@ -233,26 +234,26 @@ export class TwilioText { * Content types */ export class Types { - "twilioText"?: TwilioText | null; - "twilioMedia"?: TwilioMedia | null; - "twilioLocation"?: TwilioLocation | null; - "twilioListPicker"?: TwilioListPicker | null; - "twilioCallToAction"?: TwilioCallToAction | null; - "twilioQuickReply"?: TwilioQuickReply | null; - "twilioCard"?: TwilioCard | null; - "twilioCatalog"?: TwilioCatalog | null; - "twilioCarousel"?: TwilioCarousel | null; - "twilioFlows"?: TwilioFlows | null; - "whatsappCard"?: WhatsappCard | null; - "whatsappAuthentication"?: WhatsappAuthentication | null; + "twilio/text"?: TwilioText | null; + "twilio/media"?: TwilioMedia | null; + "twilio/location"?: TwilioLocation | null; + "twilio/list-picker"?: TwilioListPicker | null; + "twilio/call-to-action"?: TwilioCallToAction | null; + "twilio/quick-reply"?: TwilioQuickReply | null; + "twilio/card"?: TwilioCard | null; + "twilio/catalog"?: TwilioCatalog | null; + "twilio/carousel"?: TwilioCarousel | null; + "twilio/flows"?: TwilioFlows | null; + "whatsapp/card"?: WhatsappCard | null; + "whatsapp/authentication"?: WhatsappAuthentication | null; } /** * whatsApp/authentication templates let companies deliver WA approved one-time-password button. */ export class WhatsappAuthentication { - "addSecurityRecommendation"?: boolean; - "codeExpirationMinutes"?: number; + "add_security_recommendation"?: boolean; + "code_expiration_minutes"?: number; "actions": Array; } @@ -263,7 +264,7 @@ export class WhatsappCard { "body": string; "footer"?: string; "media"?: Array; - "headerText"?: string; + "header_text"?: string; "actions"?: Array; } @@ -380,11 +381,14 @@ export class ContentContextImpl implements ContentContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -397,11 +401,15 @@ export class ContentContextImpl implements ContentContext { fetch( callback?: (error: Error | null, item?: ContentInstance) => any ): Promise { + 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( @@ -593,12 +601,14 @@ export interface ContentListInstance { * Create a ContentInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ContentInstance */ create( params: ContentCreateRequest, + headers?: any, callback?: (error: Error | null, item?: ContentInstance) => any ): Promise; @@ -691,6 +701,7 @@ export function ContentListInstance(version: V1): ContentListInstance { instance.create = function create( params: ContentCreateRequest, + headers?: any, callback?: (error: Error | null, items: ContentInstance) => any ): Promise { if (params === null || params === undefined) { @@ -701,8 +712,12 @@ export function ContentListInstance(version: V1): ContentListInstance { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -744,6 +759,7 @@ export function ContentListInstance(version: V1): ContentListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/content/v1/content/approvalCreate.ts b/src/rest/content/v1/content/approvalCreate.ts index 357aee4331..5a3b7a2220 100644 --- a/src/rest/content/v1/content/approvalCreate.ts +++ b/src/rest/content/v1/content/approvalCreate.ts @@ -53,12 +53,14 @@ export interface ApprovalCreateListInstance { * Create a ApprovalCreateInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ApprovalCreateInstance */ create( params: ContentApprovalRequest, + headers?: any, callback?: (error: Error | null, item?: ApprovalCreateInstance) => any ): Promise; @@ -85,6 +87,7 @@ export function ApprovalCreateListInstance( instance.create = function create( params: ContentApprovalRequest, + headers?: any, callback?: (error: Error | null, items: ApprovalCreateInstance) => any ): Promise { if (params === null || params === undefined) { @@ -95,8 +98,12 @@ export function ApprovalCreateListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/content/v1/content/approvalFetch.ts b/src/rest/content/v1/content/approvalFetch.ts index 63f7161ea3..7f78ec6371 100644 --- a/src/rest/content/v1/content/approvalFetch.ts +++ b/src/rest/content/v1/content/approvalFetch.ts @@ -57,11 +57,15 @@ export class ApprovalFetchContextImpl implements ApprovalFetchContext { fetch( callback?: (error: Error | null, item?: ApprovalFetchInstance) => any ): Promise { + 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( diff --git a/src/rest/content/v1/contentAndApprovals.ts b/src/rest/content/v1/contentAndApprovals.ts index ae91780152..5eccc10981 100644 --- a/src/rest/content/v1/contentAndApprovals.ts +++ b/src/rest/content/v1/contentAndApprovals.ts @@ -184,6 +184,7 @@ export function ContentAndApprovalsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/content/v1/legacyContent.ts b/src/rest/content/v1/legacyContent.ts index 343e0204af..d276f44b3f 100644 --- a/src/rest/content/v1/legacyContent.ts +++ b/src/rest/content/v1/legacyContent.ts @@ -175,6 +175,7 @@ export function LegacyContentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/content/v2/content.ts b/src/rest/content/v2/content.ts index 2120b44ddc..f63c693ba5 100644 --- a/src/rest/content/v2/content.ts +++ b/src/rest/content/v2/content.ts @@ -248,6 +248,7 @@ export function ContentListInstance(version: V2): ContentListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/content/v2/contentAndApprovals.ts b/src/rest/content/v2/contentAndApprovals.ts index afc9ded69f..f7dd4da777 100644 --- a/src/rest/content/v2/contentAndApprovals.ts +++ b/src/rest/content/v2/contentAndApprovals.ts @@ -265,6 +265,7 @@ export function ContentAndApprovalsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/V1.ts b/src/rest/conversations/V1.ts index 444da61786..06afceed06 100644 --- a/src/rest/conversations/V1.ts +++ b/src/rest/conversations/V1.ts @@ -17,6 +17,7 @@ import Version from "../../base/Version"; import { AddressConfigurationListInstance } from "./v1/addressConfiguration"; import { ConfigurationListInstance } from "./v1/configuration"; import { ConversationListInstance } from "./v1/conversation"; +import { ConversationWithParticipantsListInstance } from "./v1/conversationWithParticipants"; import { CredentialListInstance } from "./v1/credential"; import { ParticipantConversationListInstance } from "./v1/participantConversation"; import { RoleListInstance } from "./v1/role"; @@ -39,6 +40,8 @@ export default class V1 extends Version { protected _configuration?: ConfigurationListInstance; /** conversations - { Twilio.Conversations.V1.ConversationListInstance } resource */ protected _conversations?: ConversationListInstance; + /** conversationWithParticipants - { Twilio.Conversations.V1.ConversationWithParticipantsListInstance } resource */ + protected _conversationWithParticipants?: ConversationWithParticipantsListInstance; /** credentials - { Twilio.Conversations.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** participantConversations - { Twilio.Conversations.V1.ParticipantConversationListInstance } resource */ @@ -70,6 +73,14 @@ export default class V1 extends Version { return this._conversations; } + /** Getter for conversationWithParticipants resource */ + get conversationWithParticipants(): ConversationWithParticipantsListInstance { + this._conversationWithParticipants = + this._conversationWithParticipants || + ConversationWithParticipantsListInstance(this); + return this._conversationWithParticipants; + } + /** Getter for credentials resource */ get credentials(): CredentialListInstance { this._credentials = this._credentials || CredentialListInstance(this); diff --git a/src/rest/conversations/v1/addressConfiguration.ts b/src/rest/conversations/v1/addressConfiguration.ts index 3b2419f9a2..58b6766b6c 100644 --- a/src/rest/conversations/v1/addressConfiguration.ts +++ b/src/rest/conversations/v1/addressConfiguration.ts @@ -207,11 +207,14 @@ export class AddressConfigurationContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -224,11 +227,15 @@ export class AddressConfigurationContextImpl fetch( callback?: (error: Error | null, item?: AddressConfigurationInstance) => any ): Promise { + 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( @@ -290,6 +297,7 @@ export class AddressConfigurationContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -675,6 +683,7 @@ export function AddressConfigurationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -717,6 +726,7 @@ export function AddressConfigurationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/configuration.ts b/src/rest/conversations/v1/configuration.ts index 166c4ed2e1..2877158294 100644 --- a/src/rest/conversations/v1/configuration.ts +++ b/src/rest/conversations/v1/configuration.ts @@ -89,11 +89,15 @@ export class ConfigurationContextImpl implements ConfigurationContext { fetch( callback?: (error: Error | null, item?: ConfigurationInstance) => any ): Promise { + 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( @@ -133,6 +137,7 @@ export class ConfigurationContextImpl implements ConfigurationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/conversations/v1/configuration/webhook.ts b/src/rest/conversations/v1/configuration/webhook.ts index 8270a1c54c..c87737cc93 100644 --- a/src/rest/conversations/v1/configuration/webhook.ts +++ b/src/rest/conversations/v1/configuration/webhook.ts @@ -94,11 +94,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -138,6 +142,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/conversations/v1/conversation.ts b/src/rest/conversations/v1/conversation.ts index 2e2b2b5afe..32999d03a6 100644 --- a/src/rest/conversations/v1/conversation.ts +++ b/src/rest/conversations/v1/conversation.ts @@ -295,11 +295,15 @@ export class ConversationContextImpl implements ConversationContext { fetch( callback?: (error: Error | null, item?: ConversationInstance) => any ): Promise { + 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( @@ -357,6 +361,7 @@ export class ConversationContextImpl implements ConversationContext { 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"]; @@ -789,6 +794,7 @@ export function ConversationListInstance( 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"]; @@ -836,6 +842,7 @@ export function ConversationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/conversation/message.ts b/src/rest/conversations/v1/conversation/message.ts index 9e080a014e..43ec2da473 100644 --- a/src/rest/conversations/v1/conversation/message.ts +++ b/src/rest/conversations/v1/conversation/message.ts @@ -260,11 +260,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -311,6 +315,7 @@ export class MessageContextImpl implements MessageContext { 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"]; @@ -748,6 +753,7 @@ export function MessageListInstance( 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"]; @@ -797,6 +803,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/conversation/message/deliveryReceipt.ts b/src/rest/conversations/v1/conversation/message/deliveryReceipt.ts index b45c1f35e0..4ebc33e1dd 100644 --- a/src/rest/conversations/v1/conversation/message/deliveryReceipt.ts +++ b/src/rest/conversations/v1/conversation/message/deliveryReceipt.ts @@ -120,11 +120,15 @@ export class DeliveryReceiptContextImpl implements DeliveryReceiptContext { fetch( callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any ): Promise { + 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( @@ -440,6 +444,7 @@ export function DeliveryReceiptListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/conversation/participant.ts b/src/rest/conversations/v1/conversation/participant.ts index 3e7414519a..e647ff65be 100644 --- a/src/rest/conversations/v1/conversation/participant.ts +++ b/src/rest/conversations/v1/conversation/participant.ts @@ -240,11 +240,15 @@ export class ParticipantContextImpl implements ParticipantContext { fetch( callback?: (error: Error | null, item?: ParticipantInstance) => any ): Promise { + 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( @@ -300,6 +304,7 @@ export class ParticipantContextImpl implements ParticipantContext { 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"]; @@ -713,6 +718,7 @@ export function ParticipantListInstance( 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"]; @@ -761,6 +767,7 @@ export function ParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/conversation/webhook.ts b/src/rest/conversations/v1/conversation/webhook.ts index 8da2e93ecb..84135c2443 100644 --- a/src/rest/conversations/v1/conversation/webhook.ts +++ b/src/rest/conversations/v1/conversation/webhook.ts @@ -173,11 +173,14 @@ export class WebhookContextImpl implements WebhookContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -190,11 +193,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -248,6 +255,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -604,6 +612,7 @@ export function WebhookListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -650,6 +659,7 @@ export function WebhookListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/conversationWithParticipants.ts b/src/rest/conversations/v1/conversationWithParticipants.ts new file mode 100644 index 0000000000..4b8141f555 --- /dev/null +++ b/src/rest/conversations/v1/conversationWithParticipants.ts @@ -0,0 +1,319 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Conversations + * 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 type ConversationWithParticipantsState = + | "inactive" + | "active" + | "closed"; + +export type ConversationWithParticipantsWebhookEnabledType = "true" | "false"; + +/** + * Options to pass to create a ConversationWithParticipantsInstance + */ +export interface ConversationWithParticipantsListInstanceCreateOptions { + /** The X-Twilio-Webhook-Enabled HTTP request header */ + xTwilioWebhookEnabled?: ConversationWithParticipantsWebhookEnabledType; + /** The human-readable name of this conversation, limited to 256 characters. Optional. */ + friendlyName?: string; + /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. */ + uniqueName?: string; + /** The date that this resource was created. */ + dateCreated?: Date; + /** The date that this resource was last updated. */ + dateUpdated?: Date; + /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ + messagingServiceSid?: string; + /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ + attributes?: string; + /** */ + state?: ConversationWithParticipantsState; + /** ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ + "timers.inactive"?: string; + /** ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ + "timers.closed"?: string; + /** The default email address that will be used when sending outbound emails in this conversation. */ + "bindings.email.address"?: string; + /** The default name that will be used when sending outbound emails in this conversation. */ + "bindings.email.name"?: string; + /** The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. */ + participant?: Array; +} + +export interface ConversationWithParticipantsSolution {} + +export interface ConversationWithParticipantsListInstance { + _version: V1; + _solution: ConversationWithParticipantsSolution; + _uri: string; + + /** + * Create a ConversationWithParticipantsInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ConversationWithParticipantsInstance + */ + create( + callback?: ( + error: Error | null, + item?: ConversationWithParticipantsInstance + ) => any + ): Promise; + /** + * Create a ConversationWithParticipantsInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ConversationWithParticipantsInstance + */ + create( + params: ConversationWithParticipantsListInstanceCreateOptions, + callback?: ( + error: Error | null, + item?: ConversationWithParticipantsInstance + ) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function ConversationWithParticipantsListInstance( + version: V1 +): ConversationWithParticipantsListInstance { + const instance = {} as ConversationWithParticipantsListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/ConversationWithParticipants`; + + instance.create = function create( + params?: + | ConversationWithParticipantsListInstanceCreateOptions + | (( + error: Error | null, + items: ConversationWithParticipantsInstance + ) => any), + callback?: ( + error: Error | null, + items: ConversationWithParticipantsInstance + ) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["friendlyName"] !== undefined) + data["FriendlyName"] = params["friendlyName"]; + if (params["uniqueName"] !== undefined) + data["UniqueName"] = params["uniqueName"]; + if (params["dateCreated"] !== undefined) + data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); + if (params["dateUpdated"] !== undefined) + data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); + if (params["messagingServiceSid"] !== undefined) + data["MessagingServiceSid"] = params["messagingServiceSid"]; + if (params["attributes"] !== undefined) + data["Attributes"] = params["attributes"]; + if (params["state"] !== undefined) data["State"] = params["state"]; + if (params["timers.inactive"] !== undefined) + data["Timers.Inactive"] = params["timers.inactive"]; + if (params["timers.closed"] !== undefined) + data["Timers.Closed"] = params["timers.closed"]; + if (params["bindings.email.address"] !== undefined) + data["Bindings.Email.Address"] = params["bindings.email.address"]; + if (params["bindings.email.name"] !== undefined) + data["Bindings.Email.Name"] = params["bindings.email.name"]; + if (params["participant"] !== undefined) + data["Participant"] = serialize.map( + params["participant"], + (e: string) => e + ); + + 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"]; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new ConversationWithParticipantsInstance(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; +} + +interface ConversationWithParticipantsPayload + extends ConversationWithParticipantsResource {} + +interface ConversationWithParticipantsResource { + account_sid: string; + chat_service_sid: string; + messaging_service_sid: string; + sid: string; + friendly_name: string; + unique_name: string; + attributes: string; + state: ConversationWithParticipantsState; + date_created: Date; + date_updated: Date; + timers: any; + links: Record; + bindings: any; + url: string; +} + +export class ConversationWithParticipantsInstance { + constructor( + protected _version: V1, + payload: ConversationWithParticipantsResource + ) { + this.accountSid = payload.account_sid; + this.chatServiceSid = payload.chat_service_sid; + this.messagingServiceSid = payload.messaging_service_sid; + this.sid = payload.sid; + this.friendlyName = payload.friendly_name; + this.uniqueName = payload.unique_name; + this.attributes = payload.attributes; + this.state = payload.state; + this.dateCreated = deserialize.iso8601DateTime(payload.date_created); + this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + this.timers = payload.timers; + this.links = payload.links; + this.bindings = payload.bindings; + this.url = payload.url; + } + + /** + * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + */ + accountSid: string; + /** + * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + */ + chatServiceSid: string; + /** + * The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + */ + messagingServiceSid: string; + /** + * A 34 character string that uniquely identifies this resource. + */ + sid: string; + /** + * The human-readable name of this conversation, limited to 256 characters. Optional. + */ + friendlyName: string; + /** + * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. + */ + uniqueName: string; + /** + * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + */ + attributes: string; + state: ConversationWithParticipantsState; + /** + * The date that this resource was created. + */ + dateCreated: Date; + /** + * The date that this resource was last updated. + */ + dateUpdated: Date; + /** + * Timer date values representing state update for this conversation. + */ + timers: any; + /** + * Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + */ + links: Record; + bindings: any; + /** + * An absolute API resource URL for this conversation. + */ + url: string; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accountSid: this.accountSid, + chatServiceSid: this.chatServiceSid, + messagingServiceSid: this.messagingServiceSid, + sid: this.sid, + friendlyName: this.friendlyName, + uniqueName: this.uniqueName, + attributes: this.attributes, + state: this.state, + dateCreated: this.dateCreated, + dateUpdated: this.dateUpdated, + timers: this.timers, + links: this.links, + bindings: this.bindings, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/conversations/v1/credential.ts b/src/rest/conversations/v1/credential.ts index 765394ad4e..5f70f0171c 100644 --- a/src/rest/conversations/v1/credential.ts +++ b/src/rest/conversations/v1/credential.ts @@ -170,11 +170,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -187,11 +190,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -239,6 +246,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -569,6 +577,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -610,6 +619,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/participantConversation.ts b/src/rest/conversations/v1/participantConversation.ts index d897fd1466..c8a8b7672e 100644 --- a/src/rest/conversations/v1/participantConversation.ts +++ b/src/rest/conversations/v1/participantConversation.ts @@ -200,6 +200,7 @@ export function ParticipantConversationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/role.ts b/src/rest/conversations/v1/role.ts index e5d460040c..d3460e3e7a 100644 --- a/src/rest/conversations/v1/role.ts +++ b/src/rest/conversations/v1/role.ts @@ -140,11 +140,14 @@ export class RoleContextImpl implements RoleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -157,11 +160,15 @@ export class RoleContextImpl implements RoleContext { fetch( callback?: (error: Error | null, item?: RoleInstance) => any ): Promise { + 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( @@ -194,6 +201,7 @@ export class RoleContextImpl implements RoleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -517,6 +525,7 @@ export function RoleListInstance(version: V1): RoleListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -558,6 +567,7 @@ export function RoleListInstance(version: V1): RoleListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service.ts b/src/rest/conversations/v1/service.ts index b857d33c0a..93c80201c2 100644 --- a/src/rest/conversations/v1/service.ts +++ b/src/rest/conversations/v1/service.ts @@ -22,6 +22,7 @@ import { isValidPathParam } from "../../../base/utility"; import { BindingListInstance } from "./service/binding"; import { ConfigurationListInstance } from "./service/configuration"; import { ConversationListInstance } from "./service/conversation"; +import { ConversationWithParticipantsListInstance } from "./service/conversationWithParticipants"; import { ParticipantConversationListInstance } from "./service/participantConversation"; import { RoleListInstance } from "./service/role"; import { UserListInstance } from "./service/user"; @@ -73,6 +74,7 @@ export interface ServiceContext { bindings: BindingListInstance; configuration: ConfigurationListInstance; conversations: ConversationListInstance; + conversationWithParticipants: ConversationWithParticipantsListInstance; participantConversations: ParticipantConversationListInstance; roles: RoleListInstance; users: UserListInstance; @@ -117,6 +119,7 @@ export class ServiceContextImpl implements ServiceContext { protected _bindings?: BindingListInstance; protected _configuration?: ConfigurationListInstance; protected _conversations?: ConversationListInstance; + protected _conversationWithParticipants?: ConversationWithParticipantsListInstance; protected _participantConversations?: ParticipantConversationListInstance; protected _roles?: RoleListInstance; protected _users?: UserListInstance; @@ -150,6 +153,16 @@ export class ServiceContextImpl implements ServiceContext { return this._conversations; } + get conversationWithParticipants(): ConversationWithParticipantsListInstance { + this._conversationWithParticipants = + this._conversationWithParticipants || + ConversationWithParticipantsListInstance( + this._version, + this._solution.sid + ); + return this._conversationWithParticipants; + } + get participantConversations(): ParticipantConversationListInstance { this._participantConversations = this._participantConversations || @@ -172,11 +185,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -189,11 +205,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -335,6 +355,13 @@ export class ServiceInstance { return this._proxy.conversations; } + /** + * Access the conversationWithParticipants. + */ + conversationWithParticipants(): ConversationWithParticipantsListInstance { + return this._proxy.conversationWithParticipants; + } + /** * Access the participantConversations. */ @@ -509,6 +536,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -550,6 +578,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/binding.ts b/src/rest/conversations/v1/service/binding.ts index 59932624b3..098c10d28c 100644 --- a/src/rest/conversations/v1/service/binding.ts +++ b/src/rest/conversations/v1/service/binding.ts @@ -125,11 +125,14 @@ export class BindingContextImpl implements BindingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -142,11 +145,15 @@ export class BindingContextImpl implements BindingContext { fetch( callback?: (error: Error | null, item?: BindingInstance) => any ): Promise { + 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( @@ -462,6 +469,7 @@ export function BindingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/configuration.ts b/src/rest/conversations/v1/service/configuration.ts index 3022e7ed22..c6685dd69c 100644 --- a/src/rest/conversations/v1/service/configuration.ts +++ b/src/rest/conversations/v1/service/configuration.ts @@ -96,11 +96,15 @@ export class ConfigurationContextImpl implements ConfigurationContext { fetch( callback?: (error: Error | null, item?: ConfigurationInstance) => any ): Promise { + 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( @@ -148,6 +152,7 @@ export class ConfigurationContextImpl implements ConfigurationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/conversations/v1/service/configuration/notification.ts b/src/rest/conversations/v1/service/configuration/notification.ts index 3880882555..e44fd30ba8 100644 --- a/src/rest/conversations/v1/service/configuration/notification.ts +++ b/src/rest/conversations/v1/service/configuration/notification.ts @@ -112,11 +112,15 @@ export class NotificationContextImpl implements NotificationContext { fetch( callback?: (error: Error | null, item?: NotificationInstance) => any ): Promise { + 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( @@ -191,6 +195,7 @@ export class NotificationContextImpl implements NotificationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/conversations/v1/service/configuration/webhook.ts b/src/rest/conversations/v1/service/configuration/webhook.ts index 38faf3fbdd..cdc3716c1c 100644 --- a/src/rest/conversations/v1/service/configuration/webhook.ts +++ b/src/rest/conversations/v1/service/configuration/webhook.ts @@ -96,11 +96,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -144,6 +148,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/conversations/v1/service/conversation.ts b/src/rest/conversations/v1/service/conversation.ts index 6284f101ed..979d8e8fcf 100644 --- a/src/rest/conversations/v1/service/conversation.ts +++ b/src/rest/conversations/v1/service/conversation.ts @@ -314,11 +314,15 @@ export class ConversationContextImpl implements ConversationContext { fetch( callback?: (error: Error | null, item?: ConversationInstance) => any ): Promise { + 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( @@ -377,6 +381,7 @@ export class ConversationContextImpl implements ConversationContext { 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"]; @@ -822,6 +827,7 @@ export function ConversationListInstance( 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"]; @@ -874,6 +880,7 @@ export function ConversationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/conversation/message.ts b/src/rest/conversations/v1/service/conversation/message.ts index 736505e16b..b1915ab7c2 100644 --- a/src/rest/conversations/v1/service/conversation/message.ts +++ b/src/rest/conversations/v1/service/conversation/message.ts @@ -271,11 +271,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -323,6 +327,7 @@ export class MessageContextImpl implements MessageContext { 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"]; @@ -781,6 +786,7 @@ export function MessageListInstance( 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"]; @@ -831,6 +837,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/conversation/message/deliveryReceipt.ts b/src/rest/conversations/v1/service/conversation/message/deliveryReceipt.ts index 5c6bd8527b..5f489187bc 100644 --- a/src/rest/conversations/v1/service/conversation/message/deliveryReceipt.ts +++ b/src/rest/conversations/v1/service/conversation/message/deliveryReceipt.ts @@ -126,11 +126,15 @@ export class DeliveryReceiptContextImpl implements DeliveryReceiptContext { fetch( callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any ): Promise { + 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( @@ -468,6 +472,7 @@ export function DeliveryReceiptListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/conversation/participant.ts b/src/rest/conversations/v1/service/conversation/participant.ts index 1b032feb64..9b6ec7b90f 100644 --- a/src/rest/conversations/v1/service/conversation/participant.ts +++ b/src/rest/conversations/v1/service/conversation/participant.ts @@ -250,11 +250,15 @@ export class ParticipantContextImpl implements ParticipantContext { fetch( callback?: (error: Error | null, item?: ParticipantInstance) => any ): Promise { + 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( @@ -311,6 +315,7 @@ export class ParticipantContextImpl implements ParticipantContext { 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"]; @@ -745,6 +750,7 @@ export function ParticipantListInstance( 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"]; @@ -794,6 +800,7 @@ export function ParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/conversation/webhook.ts b/src/rest/conversations/v1/service/conversation/webhook.ts index 82d8a55de8..4badc88804 100644 --- a/src/rest/conversations/v1/service/conversation/webhook.ts +++ b/src/rest/conversations/v1/service/conversation/webhook.ts @@ -183,11 +183,14 @@ export class WebhookContextImpl implements WebhookContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -200,11 +203,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -259,6 +266,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -636,6 +644,7 @@ export function WebhookListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -683,6 +692,7 @@ export function WebhookListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/conversationWithParticipants.ts b/src/rest/conversations/v1/service/conversationWithParticipants.ts new file mode 100644 index 0000000000..8c9ddb76fb --- /dev/null +++ b/src/rest/conversations/v1/service/conversationWithParticipants.ts @@ -0,0 +1,331 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Conversations + * 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 type ConversationWithParticipantsState = + | "inactive" + | "active" + | "closed"; + +export type ConversationWithParticipantsWebhookEnabledType = "true" | "false"; + +/** + * Options to pass to create a ConversationWithParticipantsInstance + */ +export interface ConversationWithParticipantsListInstanceCreateOptions { + /** The X-Twilio-Webhook-Enabled HTTP request header */ + xTwilioWebhookEnabled?: ConversationWithParticipantsWebhookEnabledType; + /** The human-readable name of this conversation, limited to 256 characters. Optional. */ + friendlyName?: string; + /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. */ + uniqueName?: string; + /** The date that this resource was created. */ + dateCreated?: Date; + /** The date that this resource was last updated. */ + dateUpdated?: Date; + /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ + messagingServiceSid?: string; + /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ + attributes?: string; + /** */ + state?: ConversationWithParticipantsState; + /** ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ + "timers.inactive"?: string; + /** ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ + "timers.closed"?: string; + /** The default email address that will be used when sending outbound emails in this conversation. */ + "bindings.email.address"?: string; + /** The default name that will be used when sending outbound emails in this conversation. */ + "bindings.email.name"?: string; + /** The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. */ + participant?: Array; +} + +export interface ConversationWithParticipantsSolution { + chatServiceSid: string; +} + +export interface ConversationWithParticipantsListInstance { + _version: V1; + _solution: ConversationWithParticipantsSolution; + _uri: string; + + /** + * Create a ConversationWithParticipantsInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ConversationWithParticipantsInstance + */ + create( + callback?: ( + error: Error | null, + item?: ConversationWithParticipantsInstance + ) => any + ): Promise; + /** + * Create a ConversationWithParticipantsInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ConversationWithParticipantsInstance + */ + create( + params: ConversationWithParticipantsListInstanceCreateOptions, + callback?: ( + error: Error | null, + item?: ConversationWithParticipantsInstance + ) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function ConversationWithParticipantsListInstance( + version: V1, + chatServiceSid: string +): ConversationWithParticipantsListInstance { + if (!isValidPathParam(chatServiceSid)) { + throw new Error("Parameter 'chatServiceSid' is not valid."); + } + + const instance = {} as ConversationWithParticipantsListInstance; + + instance._version = version; + instance._solution = { chatServiceSid }; + instance._uri = `/Services/${chatServiceSid}/ConversationWithParticipants`; + + instance.create = function create( + params?: + | ConversationWithParticipantsListInstanceCreateOptions + | (( + error: Error | null, + items: ConversationWithParticipantsInstance + ) => any), + callback?: ( + error: Error | null, + items: ConversationWithParticipantsInstance + ) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["friendlyName"] !== undefined) + data["FriendlyName"] = params["friendlyName"]; + if (params["uniqueName"] !== undefined) + data["UniqueName"] = params["uniqueName"]; + if (params["dateCreated"] !== undefined) + data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); + if (params["dateUpdated"] !== undefined) + data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); + if (params["messagingServiceSid"] !== undefined) + data["MessagingServiceSid"] = params["messagingServiceSid"]; + if (params["attributes"] !== undefined) + data["Attributes"] = params["attributes"]; + if (params["state"] !== undefined) data["State"] = params["state"]; + if (params["timers.inactive"] !== undefined) + data["Timers.Inactive"] = params["timers.inactive"]; + if (params["timers.closed"] !== undefined) + data["Timers.Closed"] = params["timers.closed"]; + if (params["bindings.email.address"] !== undefined) + data["Bindings.Email.Address"] = params["bindings.email.address"]; + if (params["bindings.email.name"] !== undefined) + data["Bindings.Email.Name"] = params["bindings.email.name"]; + if (params["participant"] !== undefined) + data["Participant"] = serialize.map( + params["participant"], + (e: string) => e + ); + + 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"]; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new ConversationWithParticipantsInstance( + operationVersion, + payload, + instance._solution.chatServiceSid + ) + ); + + 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 ConversationWithParticipantsPayload + extends ConversationWithParticipantsResource {} + +interface ConversationWithParticipantsResource { + account_sid: string; + chat_service_sid: string; + messaging_service_sid: string; + sid: string; + friendly_name: string; + unique_name: string; + attributes: string; + state: ConversationWithParticipantsState; + date_created: Date; + date_updated: Date; + timers: any; + links: Record; + bindings: any; + url: string; +} + +export class ConversationWithParticipantsInstance { + constructor( + protected _version: V1, + payload: ConversationWithParticipantsResource, + chatServiceSid: string + ) { + this.accountSid = payload.account_sid; + this.chatServiceSid = payload.chat_service_sid; + this.messagingServiceSid = payload.messaging_service_sid; + this.sid = payload.sid; + this.friendlyName = payload.friendly_name; + this.uniqueName = payload.unique_name; + this.attributes = payload.attributes; + this.state = payload.state; + this.dateCreated = deserialize.iso8601DateTime(payload.date_created); + this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + this.timers = payload.timers; + this.links = payload.links; + this.bindings = payload.bindings; + this.url = payload.url; + } + + /** + * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + */ + accountSid: string; + /** + * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + */ + chatServiceSid: string; + /** + * The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + */ + messagingServiceSid: string; + /** + * A 34 character string that uniquely identifies this resource. + */ + sid: string; + /** + * The human-readable name of this conversation, limited to 256 characters. Optional. + */ + friendlyName: string; + /** + * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. + */ + uniqueName: string; + /** + * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + */ + attributes: string; + state: ConversationWithParticipantsState; + /** + * The date that this resource was created. + */ + dateCreated: Date; + /** + * The date that this resource was last updated. + */ + dateUpdated: Date; + /** + * Timer date values representing state update for this conversation. + */ + timers: any; + /** + * Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + */ + links: Record; + bindings: any; + /** + * An absolute API resource URL for this conversation. + */ + url: string; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accountSid: this.accountSid, + chatServiceSid: this.chatServiceSid, + messagingServiceSid: this.messagingServiceSid, + sid: this.sid, + friendlyName: this.friendlyName, + uniqueName: this.uniqueName, + attributes: this.attributes, + state: this.state, + dateCreated: this.dateCreated, + dateUpdated: this.dateUpdated, + timers: this.timers, + links: this.links, + bindings: this.bindings, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/conversations/v1/service/participantConversation.ts b/src/rest/conversations/v1/service/participantConversation.ts index 4f2ee33bd6..e1b0f51ce4 100644 --- a/src/rest/conversations/v1/service/participantConversation.ts +++ b/src/rest/conversations/v1/service/participantConversation.ts @@ -207,6 +207,7 @@ export function ParticipantConversationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/role.ts b/src/rest/conversations/v1/service/role.ts index e6f085a6b9..8c939ca1dd 100644 --- a/src/rest/conversations/v1/service/role.ts +++ b/src/rest/conversations/v1/service/role.ts @@ -145,11 +145,14 @@ export class RoleContextImpl implements RoleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class RoleContextImpl implements RoleContext { fetch( callback?: (error: Error | null, item?: RoleInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class RoleContextImpl implements RoleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -551,6 +559,7 @@ export function RoleListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -597,6 +606,7 @@ export function RoleListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/user.ts b/src/rest/conversations/v1/service/user.ts index 9477c57544..cba243441b 100644 --- a/src/rest/conversations/v1/service/user.ts +++ b/src/rest/conversations/v1/service/user.ts @@ -236,11 +236,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -283,6 +287,7 @@ export class UserContextImpl implements UserContext { 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"]; @@ -684,6 +689,7 @@ export function UserListInstance( 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"]; @@ -732,6 +738,7 @@ export function UserListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/service/user/userConversation.ts b/src/rest/conversations/v1/service/user/userConversation.ts index 774e86d14e..035de7d6b2 100644 --- a/src/rest/conversations/v1/service/user/userConversation.ts +++ b/src/rest/conversations/v1/service/user/userConversation.ts @@ -162,11 +162,14 @@ export class UserConversationContextImpl implements UserConversationContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -179,11 +182,15 @@ export class UserConversationContextImpl implements UserConversationContext { fetch( callback?: (error: Error | null, item?: UserConversationInstance) => any ): Promise { + 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( @@ -230,6 +237,7 @@ export class UserConversationContextImpl implements UserConversationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -648,6 +656,7 @@ export function UserConversationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/user.ts b/src/rest/conversations/v1/user.ts index 55a45539a9..c7a06fdfff 100644 --- a/src/rest/conversations/v1/user.ts +++ b/src/rest/conversations/v1/user.ts @@ -227,11 +227,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -269,6 +273,7 @@ export class UserContextImpl implements UserContext { 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"]; @@ -646,6 +651,7 @@ export function UserListInstance(version: V1): UserListInstance { 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"]; @@ -689,6 +695,7 @@ export function UserListInstance(version: V1): UserListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/conversations/v1/user/userConversation.ts b/src/rest/conversations/v1/user/userConversation.ts index bca39ef472..a04cf6bdb6 100644 --- a/src/rest/conversations/v1/user/userConversation.ts +++ b/src/rest/conversations/v1/user/userConversation.ts @@ -156,11 +156,14 @@ export class UserConversationContextImpl implements UserConversationContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -173,11 +176,15 @@ export class UserConversationContextImpl implements UserConversationContext { fetch( callback?: (error: Error | null, item?: UserConversationInstance) => any ): Promise { + 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( @@ -223,6 +230,7 @@ export class UserConversationContextImpl implements UserConversationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -626,6 +634,7 @@ export function UserConversationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/events/v1/eventType.ts b/src/rest/events/v1/eventType.ts index 015873f2dc..47104b7022 100644 --- a/src/rest/events/v1/eventType.ts +++ b/src/rest/events/v1/eventType.ts @@ -101,11 +101,15 @@ export class EventTypeContextImpl implements EventTypeContext { fetch( callback?: (error: Error | null, item?: EventTypeInstance) => any ): Promise { + 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( @@ -373,6 +377,7 @@ export function EventTypeListInstance(version: V1): EventTypeListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/events/v1/schema.ts b/src/rest/events/v1/schema.ts index 8c9a857cda..76c8ae8831 100644 --- a/src/rest/events/v1/schema.ts +++ b/src/rest/events/v1/schema.ts @@ -69,11 +69,15 @@ export class SchemaContextImpl implements SchemaContext { fetch( callback?: (error: Error | null, item?: SchemaInstance) => any ): Promise { + 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( diff --git a/src/rest/events/v1/schema/schemaVersion.ts b/src/rest/events/v1/schema/schemaVersion.ts index 2f3c9ab789..53ec690776 100644 --- a/src/rest/events/v1/schema/schemaVersion.ts +++ b/src/rest/events/v1/schema/schemaVersion.ts @@ -100,11 +100,15 @@ export class SchemaVersionContextImpl implements SchemaVersionContext { fetch( callback?: (error: Error | null, item?: SchemaVersionInstance) => any ): Promise { + 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( @@ -365,6 +369,7 @@ export function SchemaVersionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/events/v1/sink.ts b/src/rest/events/v1/sink.ts index 8c51106511..d3fe73f5c4 100644 --- a/src/rest/events/v1/sink.ts +++ b/src/rest/events/v1/sink.ts @@ -175,11 +175,14 @@ export class SinkContextImpl implements SinkContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -192,11 +195,15 @@ export class SinkContextImpl implements SinkContext { fetch( callback?: (error: Error | null, item?: SinkInstance) => any ): Promise { + 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( @@ -229,6 +236,7 @@ export class SinkContextImpl implements SinkContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -565,6 +573,7 @@ export function SinkListInstance(version: V1): SinkListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -609,6 +618,7 @@ export function SinkListInstance(version: V1): SinkListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/events/v1/sink/sinkTest.ts b/src/rest/events/v1/sink/sinkTest.ts index 6f89bac6f4..cec9382a5c 100644 --- a/src/rest/events/v1/sink/sinkTest.ts +++ b/src/rest/events/v1/sink/sinkTest.ts @@ -62,10 +62,14 @@ export function SinkTestListInstance( instance.create = function create( callback?: (error: Error | null, items: SinkTestInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", + headers, }); operationPromise = operationPromise.then( diff --git a/src/rest/events/v1/sink/sinkValidate.ts b/src/rest/events/v1/sink/sinkValidate.ts index afdae8cffb..a3340be130 100644 --- a/src/rest/events/v1/sink/sinkValidate.ts +++ b/src/rest/events/v1/sink/sinkValidate.ts @@ -87,6 +87,7 @@ export function SinkValidateListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/events/v1/subscription.ts b/src/rest/events/v1/subscription.ts index 4d9a919587..d33103b819 100644 --- a/src/rest/events/v1/subscription.ts +++ b/src/rest/events/v1/subscription.ts @@ -168,11 +168,14 @@ export class SubscriptionContextImpl implements SubscriptionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class SubscriptionContextImpl implements SubscriptionContext { fetch( callback?: (error: Error | null, item?: SubscriptionInstance) => any ): Promise { + 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( @@ -229,6 +236,7 @@ export class SubscriptionContextImpl implements SubscriptionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -575,6 +583,7 @@ export function SubscriptionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -617,6 +626,7 @@ export function SubscriptionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/events/v1/subscription/subscribedEvent.ts b/src/rest/events/v1/subscription/subscribedEvent.ts index 184b90ea69..afa4be0f9d 100644 --- a/src/rest/events/v1/subscription/subscribedEvent.ts +++ b/src/rest/events/v1/subscription/subscribedEvent.ts @@ -154,11 +154,14 @@ export class SubscribedEventContextImpl implements SubscribedEventContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -171,11 +174,15 @@ export class SubscribedEventContextImpl implements SubscribedEventContext { fetch( callback?: (error: Error | null, item?: SubscribedEventInstance) => any ): Promise { + 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( @@ -215,6 +222,7 @@ export class SubscribedEventContextImpl implements SubscribedEventContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -541,6 +549,7 @@ export function SubscribedEventListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -587,6 +596,7 @@ export function SubscribedEventListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v1/assessments.ts b/src/rest/flexApi/v1/assessments.ts index b684e2da8e..3e0ca71ca4 100644 --- a/src/rest/flexApi/v1/assessments.ts +++ b/src/rest/flexApi/v1/assessments.ts @@ -177,6 +177,7 @@ export class AssessmentsContextImpl implements AssessmentsContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -565,6 +566,7 @@ export function AssessmentsListInstance(version: V1): AssessmentsListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -610,6 +612,7 @@ export function AssessmentsListInstance(version: V1): AssessmentsListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/channel.ts b/src/rest/flexApi/v1/channel.ts index 1adc94bbb4..f0929d2ccd 100644 --- a/src/rest/flexApi/v1/channel.ts +++ b/src/rest/flexApi/v1/channel.ts @@ -131,11 +131,14 @@ export class ChannelContextImpl implements ChannelContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -148,11 +151,15 @@ export class ChannelContextImpl implements ChannelContext { fetch( callback?: (error: Error | null, item?: ChannelInstance) => any ): Promise { + 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( @@ -468,6 +475,7 @@ export function ChannelListInstance(version: V1): ChannelListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -509,6 +517,7 @@ export function ChannelListInstance(version: V1): ChannelListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v1/configuration.ts b/src/rest/flexApi/v1/configuration.ts index 69a03dcc00..61ff8724c9 100644 --- a/src/rest/flexApi/v1/configuration.ts +++ b/src/rest/flexApi/v1/configuration.ts @@ -74,12 +74,14 @@ export interface ConfigurationContext { * Update a ConfigurationInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update( params: object, + headers?: any, callback?: (error: Error | null, item?: ConfigurationInstance) => any ): Promise; @@ -120,6 +122,7 @@ export class ConfigurationContextImpl implements ConfigurationContext { data["UiVersion"] = params["uiVersion"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -145,6 +148,7 @@ export class ConfigurationContextImpl implements ConfigurationContext { params?: | object | ((error: Error | null, item?: ConfigurationInstance) => any), + headers?: any, callback?: (error: Error | null, item?: ConfigurationInstance) => any ): Promise { if (params instanceof Function) { @@ -158,8 +162,12 @@ export class ConfigurationContextImpl implements ConfigurationContext { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -551,12 +559,14 @@ export class ConfigurationInstance { * Update a ConfigurationInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update( params: object, + headers?: any, callback?: (error: Error | null, item?: ConfigurationInstance) => any ): Promise; diff --git a/src/rest/flexApi/v1/flexFlow.ts b/src/rest/flexApi/v1/flexFlow.ts index 84fbac9949..d6bfdcd5e2 100644 --- a/src/rest/flexApi/v1/flexFlow.ts +++ b/src/rest/flexApi/v1/flexFlow.ts @@ -224,11 +224,14 @@ export class FlexFlowContextImpl implements FlexFlowContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -241,11 +244,15 @@ export class FlexFlowContextImpl implements FlexFlowContext { fetch( callback?: (error: Error | null, item?: FlexFlowInstance) => any ): Promise { + 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( @@ -314,6 +321,7 @@ export class FlexFlowContextImpl implements FlexFlowContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -715,6 +723,7 @@ export function FlexFlowListInstance(version: V1): FlexFlowListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -758,6 +767,7 @@ export function FlexFlowListInstance(version: V1): FlexFlowListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v1/insightsAssessmentsComment.ts b/src/rest/flexApi/v1/insightsAssessmentsComment.ts index a08a7b83c7..731c27ff24 100644 --- a/src/rest/flexApi/v1/insightsAssessmentsComment.ts +++ b/src/rest/flexApi/v1/insightsAssessmentsComment.ts @@ -279,6 +279,7 @@ export function InsightsAssessmentsCommentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -329,6 +330,7 @@ export function InsightsAssessmentsCommentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsConversations.ts b/src/rest/flexApi/v1/insightsConversations.ts index 18eab7cae4..3f93998ce3 100644 --- a/src/rest/flexApi/v1/insightsConversations.ts +++ b/src/rest/flexApi/v1/insightsConversations.ts @@ -198,6 +198,7 @@ export function InsightsConversationsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsQuestionnaires.ts b/src/rest/flexApi/v1/insightsQuestionnaires.ts index f7aa2001f6..20bc5ef07d 100644 --- a/src/rest/flexApi/v1/insightsQuestionnaires.ts +++ b/src/rest/flexApi/v1/insightsQuestionnaires.ts @@ -267,6 +267,7 @@ export class InsightsQuestionnairesContextImpl let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -324,6 +325,7 @@ export class InsightsQuestionnairesContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -713,6 +715,7 @@ export function InsightsQuestionnairesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -758,6 +761,7 @@ export function InsightsQuestionnairesListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsQuestionnairesCategory.ts b/src/rest/flexApi/v1/insightsQuestionnairesCategory.ts index fdcfaaf23f..a533242ba4 100644 --- a/src/rest/flexApi/v1/insightsQuestionnairesCategory.ts +++ b/src/rest/flexApi/v1/insightsQuestionnairesCategory.ts @@ -214,6 +214,7 @@ export class InsightsQuestionnairesCategoryContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -543,6 +544,7 @@ export function InsightsQuestionnairesCategoryListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -593,6 +595,7 @@ export function InsightsQuestionnairesCategoryListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsQuestionnairesQuestion.ts b/src/rest/flexApi/v1/insightsQuestionnairesQuestion.ts index 1ee02ca678..88bf1c917e 100644 --- a/src/rest/flexApi/v1/insightsQuestionnairesQuestion.ts +++ b/src/rest/flexApi/v1/insightsQuestionnairesQuestion.ts @@ -243,6 +243,7 @@ export class InsightsQuestionnairesQuestionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -634,6 +635,7 @@ export function InsightsQuestionnairesQuestionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; @@ -689,6 +691,7 @@ export function InsightsQuestionnairesQuestionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsSegments.ts b/src/rest/flexApi/v1/insightsSegments.ts index b966242da4..25afa071ff 100644 --- a/src/rest/flexApi/v1/insightsSegments.ts +++ b/src/rest/flexApi/v1/insightsSegments.ts @@ -203,6 +203,7 @@ export function InsightsSegmentsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsSession.ts b/src/rest/flexApi/v1/insightsSession.ts index 16f28fbe3a..6077897612 100644 --- a/src/rest/flexApi/v1/insightsSession.ts +++ b/src/rest/flexApi/v1/insightsSession.ts @@ -84,6 +84,7 @@ export class InsightsSessionContextImpl implements InsightsSessionContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsSettingsAnswerSets.ts b/src/rest/flexApi/v1/insightsSettingsAnswerSets.ts index 0a7c1d8e91..94e9f20b70 100644 --- a/src/rest/flexApi/v1/insightsSettingsAnswerSets.ts +++ b/src/rest/flexApi/v1/insightsSettingsAnswerSets.ts @@ -100,6 +100,7 @@ export function InsightsSettingsAnswerSetsListInstance( let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsSettingsComment.ts b/src/rest/flexApi/v1/insightsSettingsComment.ts index c86b78387c..6b528a56ce 100644 --- a/src/rest/flexApi/v1/insightsSettingsComment.ts +++ b/src/rest/flexApi/v1/insightsSettingsComment.ts @@ -97,6 +97,7 @@ export function InsightsSettingsCommentListInstance( let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/insightsUserRoles.ts b/src/rest/flexApi/v1/insightsUserRoles.ts index 58bd78d8c7..a87e85491c 100644 --- a/src/rest/flexApi/v1/insightsUserRoles.ts +++ b/src/rest/flexApi/v1/insightsUserRoles.ts @@ -84,6 +84,7 @@ export class InsightsUserRolesContextImpl implements InsightsUserRolesContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; diff --git a/src/rest/flexApi/v1/interaction.ts b/src/rest/flexApi/v1/interaction.ts index 797a21f953..b68bed92be 100644 --- a/src/rest/flexApi/v1/interaction.ts +++ b/src/rest/flexApi/v1/interaction.ts @@ -81,11 +81,15 @@ export class InteractionContextImpl implements InteractionContext { fetch( callback?: (error: Error | null, item?: InteractionInstance) => any ): Promise { + 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( @@ -275,6 +279,7 @@ export function InteractionListInstance(version: V1): InteractionListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/flexApi/v1/interaction/interactionChannel.ts b/src/rest/flexApi/v1/interaction/interactionChannel.ts index 46843e1a42..5f7104c6d5 100644 --- a/src/rest/flexApi/v1/interaction/interactionChannel.ts +++ b/src/rest/flexApi/v1/interaction/interactionChannel.ts @@ -176,11 +176,15 @@ export class InteractionChannelContextImpl fetch( callback?: (error: Error | null, item?: InteractionChannelInstance) => any ): Promise { + 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( @@ -220,6 +224,7 @@ export class InteractionChannelContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -534,6 +539,7 @@ export function InteractionChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.ts b/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.ts index 5038977629..328712a0be 100644 --- a/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.ts +++ b/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.ts @@ -220,6 +220,7 @@ export function InteractionChannelInviteListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -267,6 +268,7 @@ export function InteractionChannelInviteListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.ts b/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.ts index 893b0651c4..f81d9c9bc5 100644 --- a/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.ts +++ b/src/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.ts @@ -166,6 +166,7 @@ export class InteractionChannelParticipantContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -509,6 +510,7 @@ export function InteractionChannelParticipantListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -562,6 +564,7 @@ export function InteractionChannelParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v1/plugin.ts b/src/rest/flexApi/v1/plugin.ts index c4a2a669b7..2808e7421a 100644 --- a/src/rest/flexApi/v1/plugin.ts +++ b/src/rest/flexApi/v1/plugin.ts @@ -194,6 +194,7 @@ export class PluginContextImpl implements PluginContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -240,6 +241,7 @@ export class PluginContextImpl implements PluginContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -582,6 +584,7 @@ export function PluginListInstance(version: V1): PluginListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -625,6 +628,7 @@ export function PluginListInstance(version: V1): PluginListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/plugin/pluginVersions.ts b/src/rest/flexApi/v1/plugin/pluginVersions.ts index ad1fa1a8af..60f387984e 100644 --- a/src/rest/flexApi/v1/plugin/pluginVersions.ts +++ b/src/rest/flexApi/v1/plugin/pluginVersions.ts @@ -161,6 +161,7 @@ export class PluginVersionsContextImpl implements PluginVersionsContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -513,6 +514,7 @@ export function PluginVersionsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -561,6 +563,7 @@ export function PluginVersionsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/pluginArchive.ts b/src/rest/flexApi/v1/pluginArchive.ts index 1cf9286626..23ab925c39 100644 --- a/src/rest/flexApi/v1/pluginArchive.ts +++ b/src/rest/flexApi/v1/pluginArchive.ts @@ -90,6 +90,7 @@ export class PluginArchiveContextImpl implements PluginArchiveContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/pluginConfiguration.ts b/src/rest/flexApi/v1/pluginConfiguration.ts index 0bd321aa60..31d0b9b68a 100644 --- a/src/rest/flexApi/v1/pluginConfiguration.ts +++ b/src/rest/flexApi/v1/pluginConfiguration.ts @@ -164,6 +164,7 @@ export class PluginConfigurationContextImpl let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -488,6 +489,7 @@ export function PluginConfigurationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -531,6 +533,7 @@ export function PluginConfigurationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/pluginConfiguration/configuredPlugin.ts b/src/rest/flexApi/v1/pluginConfiguration/configuredPlugin.ts index 6631ce7c08..d255eb8e84 100644 --- a/src/rest/flexApi/v1/pluginConfiguration/configuredPlugin.ts +++ b/src/rest/flexApi/v1/pluginConfiguration/configuredPlugin.ts @@ -145,6 +145,7 @@ export class ConfiguredPluginContextImpl implements ConfiguredPluginContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -519,6 +520,7 @@ export function ConfiguredPluginListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/pluginConfigurationArchive.ts b/src/rest/flexApi/v1/pluginConfigurationArchive.ts index 5fd9586038..6341e5a665 100644 --- a/src/rest/flexApi/v1/pluginConfigurationArchive.ts +++ b/src/rest/flexApi/v1/pluginConfigurationArchive.ts @@ -104,6 +104,7 @@ export class PluginConfigurationArchiveContextImpl let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/pluginRelease.ts b/src/rest/flexApi/v1/pluginRelease.ts index e2a56f24ba..27bb05379c 100644 --- a/src/rest/flexApi/v1/pluginRelease.ts +++ b/src/rest/flexApi/v1/pluginRelease.ts @@ -143,6 +143,7 @@ export class PluginReleaseContextImpl implements PluginReleaseContext { let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -434,6 +435,7 @@ export function PluginReleaseListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; @@ -477,6 +479,7 @@ export function PluginReleaseListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/pluginVersionArchive.ts b/src/rest/flexApi/v1/pluginVersionArchive.ts index 8a0ab054d4..182716c958 100644 --- a/src/rest/flexApi/v1/pluginVersionArchive.ts +++ b/src/rest/flexApi/v1/pluginVersionArchive.ts @@ -97,6 +97,7 @@ export class PluginVersionArchiveContextImpl let data: any = {}; const headers: any = {}; + headers["Accept"] = "application/json"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; diff --git a/src/rest/flexApi/v1/provisioningStatus.ts b/src/rest/flexApi/v1/provisioningStatus.ts index 24abfc729b..88a1ef4e4b 100644 --- a/src/rest/flexApi/v1/provisioningStatus.ts +++ b/src/rest/flexApi/v1/provisioningStatus.ts @@ -59,11 +59,15 @@ export class ProvisioningStatusContextImpl fetch( callback?: (error: Error | null, item?: ProvisioningStatusInstance) => any ): Promise { + 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( diff --git a/src/rest/flexApi/v1/webChannel.ts b/src/rest/flexApi/v1/webChannel.ts index e1a1f488b2..0e011c40b8 100644 --- a/src/rest/flexApi/v1/webChannel.ts +++ b/src/rest/flexApi/v1/webChannel.ts @@ -158,11 +158,14 @@ export class WebChannelContextImpl implements WebChannelContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -175,11 +178,15 @@ export class WebChannelContextImpl implements WebChannelContext { fetch( callback?: (error: Error | null, item?: WebChannelInstance) => any ): Promise { + 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( @@ -220,6 +227,7 @@ export class WebChannelContextImpl implements WebChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -561,6 +569,7 @@ export function WebChannelListInstance(version: V1): WebChannelListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -602,6 +611,7 @@ export function WebChannelListInstance(version: V1): WebChannelListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/flexApi/v2/flexUser.ts b/src/rest/flexApi/v2/flexUser.ts index e479685001..c9d7dd04e1 100644 --- a/src/rest/flexApi/v2/flexUser.ts +++ b/src/rest/flexApi/v2/flexUser.ts @@ -107,11 +107,15 @@ export class FlexUserContextImpl implements FlexUserContext { fetch( callback?: (error: Error | null, item?: FlexUserInstance) => any ): Promise { + 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( @@ -157,6 +161,7 @@ export class FlexUserContextImpl implements FlexUserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/flexApi/v2/webChannels.ts b/src/rest/flexApi/v2/webChannels.ts index c03160df7e..0862cac5ff 100644 --- a/src/rest/flexApi/v2/webChannels.ts +++ b/src/rest/flexApi/v2/webChannels.ts @@ -92,6 +92,7 @@ export function WebChannelsListInstance(version: V2): WebChannelsListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["uiVersion"] !== undefined) headers["Ui-Version"] = params["uiVersion"]; diff --git a/src/rest/frontlineApi/v1/user.ts b/src/rest/frontlineApi/v1/user.ts index fa8ff98b22..ca6fc4e118 100644 --- a/src/rest/frontlineApi/v1/user.ts +++ b/src/rest/frontlineApi/v1/user.ts @@ -96,11 +96,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -139,6 +143,7 @@ export class UserContextImpl implements UserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/iam/v1/apiKey.ts b/src/rest/iam/v1/apiKey.ts index 062abbe9dd..ccd2a75676 100644 --- a/src/rest/iam/v1/apiKey.ts +++ b/src/rest/iam/v1/apiKey.ts @@ -101,11 +101,14 @@ export class ApiKeyContextImpl implements ApiKeyContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -118,11 +121,15 @@ export class ApiKeyContextImpl implements ApiKeyContext { fetch( callback?: (error: Error | null, item?: ApiKeyInstance) => any ): Promise { + 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( @@ -159,6 +166,7 @@ export class ApiKeyContextImpl implements ApiKeyContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/iam/v1/getApiKeys.ts b/src/rest/iam/v1/getApiKeys.ts index 57a7e7e99e..b0b01945b9 100644 --- a/src/rest/iam/v1/getApiKeys.ts +++ b/src/rest/iam/v1/getApiKeys.ts @@ -167,6 +167,7 @@ export function GetApiKeysListInstance(version: V1): GetApiKeysListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/iam/v1/newApiKey.ts b/src/rest/iam/v1/newApiKey.ts index 2fcfb48404..ab2a5f6e83 100644 --- a/src/rest/iam/v1/newApiKey.ts +++ b/src/rest/iam/v1/newApiKey.ts @@ -91,6 +91,7 @@ export function NewApiKeyListInstance(version: V1): NewApiKeyListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/insights/v1/call.ts b/src/rest/insights/v1/call.ts index 34236273fd..574cbbba9f 100644 --- a/src/rest/insights/v1/call.ts +++ b/src/rest/insights/v1/call.ts @@ -97,11 +97,15 @@ export class CallContextImpl implements CallContext { fetch( callback?: (error: Error | null, item?: CallInstance) => any ): Promise { + 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( diff --git a/src/rest/insights/v1/call/annotation.ts b/src/rest/insights/v1/call/annotation.ts index f3444eb60a..e970ba7e09 100644 --- a/src/rest/insights/v1/call/annotation.ts +++ b/src/rest/insights/v1/call/annotation.ts @@ -110,11 +110,15 @@ export class AnnotationContextImpl implements AnnotationContext { fetch( callback?: (error: Error | null, item?: AnnotationInstance) => any ): Promise { + 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( @@ -163,6 +167,7 @@ export class AnnotationContextImpl implements AnnotationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/insights/v1/call/callSummary.ts b/src/rest/insights/v1/call/callSummary.ts index 663a190c3b..6a50fdead4 100644 --- a/src/rest/insights/v1/call/callSummary.ts +++ b/src/rest/insights/v1/call/callSummary.ts @@ -116,6 +116,7 @@ export class CallSummaryContextImpl implements CallSummaryContext { data["ProcessingState"] = params["processingState"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/insights/v1/call/event.ts b/src/rest/insights/v1/call/event.ts index b45209ce2b..017b009c2b 100644 --- a/src/rest/insights/v1/call/event.ts +++ b/src/rest/insights/v1/call/event.ts @@ -192,6 +192,7 @@ export function EventListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/call/metric.ts b/src/rest/insights/v1/call/metric.ts index 932e1d8da6..58e4390df0 100644 --- a/src/rest/insights/v1/call/metric.ts +++ b/src/rest/insights/v1/call/metric.ts @@ -200,6 +200,7 @@ export function MetricListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/callSummaries.ts b/src/rest/insights/v1/callSummaries.ts index 49f9066a39..164fde7f61 100644 --- a/src/rest/insights/v1/callSummaries.ts +++ b/src/rest/insights/v1/callSummaries.ts @@ -460,6 +460,7 @@ export function CallSummariesListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/conference.ts b/src/rest/insights/v1/conference.ts index fc6e7c7a6e..b3fbd394f8 100644 --- a/src/rest/insights/v1/conference.ts +++ b/src/rest/insights/v1/conference.ts @@ -56,7 +56,8 @@ export type ConferenceTag = | "high_jitter" | "high_latency" | "low_mos" - | "detected_silence"; + | "detected_silence" + | "no_concurrent_participants"; /** * Options to pass to each @@ -207,11 +208,15 @@ export class ConferenceContextImpl implements ConferenceContext { fetch( callback?: (error: Error | null, item?: ConferenceInstance) => any ): Promise { + 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( @@ -594,6 +599,7 @@ export function ConferenceListInstance(version: V1): ConferenceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/conference/conferenceParticipant.ts b/src/rest/insights/v1/conference/conferenceParticipant.ts index 3244c315fa..a3306511ac 100644 --- a/src/rest/insights/v1/conference/conferenceParticipant.ts +++ b/src/rest/insights/v1/conference/conferenceParticipant.ts @@ -207,6 +207,7 @@ export class ConferenceParticipantContextImpl if (params["metrics"] !== undefined) data["Metrics"] = params["metrics"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -658,6 +659,7 @@ export function ConferenceParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/room.ts b/src/rest/insights/v1/room.ts index a75519c4fc..03de53adaf 100644 --- a/src/rest/insights/v1/room.ts +++ b/src/rest/insights/v1/room.ts @@ -21,7 +21,7 @@ const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; import { ParticipantListInstance } from "./room/participant"; -export type RoomCodec = "VP8" | "H264" | "VP9"; +export type RoomCodec = "VP8" | "H264" | "VP9" | "opus"; export type RoomCreatedMethod = "sdk" | "ad_hoc" | "api"; @@ -54,7 +54,9 @@ export type RoomTwilioRealm = | "sg1" | "in1" | "de1" - | "gll"; + | "gll" + | "stage_us1" + | "dev_us1"; /** * Options to pass to each @@ -172,11 +174,15 @@ export class RoomContextImpl implements RoomContext { fetch( callback?: (error: Error | null, item?: RoomInstance) => any ): Promise { + 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( @@ -563,6 +569,7 @@ export function RoomListInstance(version: V1): RoomListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/room/participant.ts b/src/rest/insights/v1/room/participant.ts index 8c6ba1311a..814ccdd7e7 100644 --- a/src/rest/insights/v1/room/participant.ts +++ b/src/rest/insights/v1/room/participant.ts @@ -20,7 +20,7 @@ const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; -export type ParticipantCodec = "VP8" | "H264" | "VP9"; +export type ParticipantCodec = "VP8" | "H264" | "VP9" | "opus"; export type ParticipantEdgeLocation = | "ashburn" @@ -45,7 +45,9 @@ export type ParticipantTwilioRealm = | "sg1" | "in1" | "de1" - | "gll"; + | "gll" + | "stage_us1" + | "dev_us1"; /** * Options to pass to each @@ -127,11 +129,15 @@ export class ParticipantContextImpl implements ParticipantContext { fetch( callback?: (error: Error | null, item?: ParticipantInstance) => any ): Promise { + 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( @@ -467,6 +473,7 @@ export function ParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/insights/v1/setting.ts b/src/rest/insights/v1/setting.ts index bf79a8bee9..a83223fe90 100644 --- a/src/rest/insights/v1/setting.ts +++ b/src/rest/insights/v1/setting.ts @@ -122,6 +122,7 @@ export class SettingContextImpl implements SettingContext { data["SubaccountSid"] = params["subaccountSid"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -167,6 +168,7 @@ export class SettingContextImpl implements SettingContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/intelligence/v2/customOperator.ts b/src/rest/intelligence/v2/customOperator.ts index bc11812bc1..eba010380d 100644 --- a/src/rest/intelligence/v2/customOperator.ts +++ b/src/rest/intelligence/v2/customOperator.ts @@ -163,11 +163,14 @@ export class CustomOperatorContextImpl implements CustomOperatorContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -180,11 +183,15 @@ export class CustomOperatorContextImpl implements CustomOperatorContext { fetch( callback?: (error: Error | null, item?: CustomOperatorInstance) => any ): Promise { + 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( @@ -230,6 +237,7 @@ export class CustomOperatorContextImpl implements CustomOperatorContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -596,6 +604,7 @@ export function CustomOperatorListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -641,6 +650,7 @@ export function CustomOperatorListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/operator.ts b/src/rest/intelligence/v2/operator.ts index 2a221d5cc6..57b251e09c 100644 --- a/src/rest/intelligence/v2/operator.ts +++ b/src/rest/intelligence/v2/operator.ts @@ -109,11 +109,15 @@ export class OperatorContextImpl implements OperatorContext { fetch( callback?: (error: Error | null, item?: OperatorInstance) => any ): Promise { + 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( @@ -397,6 +401,7 @@ export function OperatorListInstance(version: V2): OperatorListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/operatorAttachment.ts b/src/rest/intelligence/v2/operatorAttachment.ts index 09d27622b9..eaacc980c2 100644 --- a/src/rest/intelligence/v2/operatorAttachment.ts +++ b/src/rest/intelligence/v2/operatorAttachment.ts @@ -75,11 +75,15 @@ export class OperatorAttachmentContextImpl create( callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", + headers, }); operationPromise = operationPromise.then( @@ -102,11 +106,14 @@ export class OperatorAttachmentContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( diff --git a/src/rest/intelligence/v2/operatorAttachments.ts b/src/rest/intelligence/v2/operatorAttachments.ts index d96afeca3c..b38f5328a1 100644 --- a/src/rest/intelligence/v2/operatorAttachments.ts +++ b/src/rest/intelligence/v2/operatorAttachments.ts @@ -59,11 +59,15 @@ export class OperatorAttachmentsContextImpl fetch( callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any ): Promise { + 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( diff --git a/src/rest/intelligence/v2/operatorType.ts b/src/rest/intelligence/v2/operatorType.ts index 949d9040e3..627a1ada50 100644 --- a/src/rest/intelligence/v2/operatorType.ts +++ b/src/rest/intelligence/v2/operatorType.ts @@ -110,11 +110,15 @@ export class OperatorTypeContextImpl implements OperatorTypeContext { fetch( callback?: (error: Error | null, item?: OperatorTypeInstance) => any ): Promise { + 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( @@ -412,6 +416,7 @@ export function OperatorTypeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/prebuiltOperator.ts b/src/rest/intelligence/v2/prebuiltOperator.ts index 768e0f3559..da641a297b 100644 --- a/src/rest/intelligence/v2/prebuiltOperator.ts +++ b/src/rest/intelligence/v2/prebuiltOperator.ts @@ -116,11 +116,15 @@ export class PrebuiltOperatorContextImpl implements PrebuiltOperatorContext { fetch( callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any ): Promise { + 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( @@ -420,6 +424,7 @@ export function PrebuiltOperatorListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/service.ts b/src/rest/intelligence/v2/service.ts index efa49a506f..0be6f114c7 100644 --- a/src/rest/intelligence/v2/service.ts +++ b/src/rest/intelligence/v2/service.ts @@ -178,11 +178,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -195,11 +198,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -248,6 +255,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -635,6 +643,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -676,6 +685,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/transcript.ts b/src/rest/intelligence/v2/transcript.ts index a76758a690..7556a7e83c 100644 --- a/src/rest/intelligence/v2/transcript.ts +++ b/src/rest/intelligence/v2/transcript.ts @@ -205,11 +205,14 @@ export class TranscriptContextImpl implements TranscriptContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -222,11 +225,15 @@ export class TranscriptContextImpl implements TranscriptContext { fetch( callback?: (error: Error | null, item?: TranscriptInstance) => any ): Promise { + 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( @@ -585,6 +592,7 @@ export function TranscriptListInstance(version: V2): TranscriptListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -641,6 +649,7 @@ export function TranscriptListInstance(version: V2): TranscriptListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/transcript/media.ts b/src/rest/intelligence/v2/transcript/media.ts index 0a0da5521d..a9b46e14ca 100644 --- a/src/rest/intelligence/v2/transcript/media.ts +++ b/src/rest/intelligence/v2/transcript/media.ts @@ -93,6 +93,7 @@ export class MediaContextImpl implements MediaContext { data["Redacted"] = serialize.bool(params["redacted"]); const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/intelligence/v2/transcript/operatorResult.ts b/src/rest/intelligence/v2/transcript/operatorResult.ts index e167dce110..7ceb2b2b53 100644 --- a/src/rest/intelligence/v2/transcript/operatorResult.ts +++ b/src/rest/intelligence/v2/transcript/operatorResult.ts @@ -155,6 +155,7 @@ export class OperatorResultContextImpl implements OperatorResultContext { data["Redacted"] = serialize.bool(params["redacted"]); const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -515,6 +516,7 @@ export function OperatorResultListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/intelligence/v2/transcript/sentence.ts b/src/rest/intelligence/v2/transcript/sentence.ts index 7e3eb2a3fb..68b58df4a7 100644 --- a/src/rest/intelligence/v2/transcript/sentence.ts +++ b/src/rest/intelligence/v2/transcript/sentence.ts @@ -192,6 +192,7 @@ export function SentenceListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/credential.ts b/src/rest/ipMessaging/v1/credential.ts index 7dff3c9d63..24dcb480f5 100644 --- a/src/rest/ipMessaging/v1/credential.ts +++ b/src/rest/ipMessaging/v1/credential.ts @@ -168,11 +168,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -545,6 +553,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -586,6 +595,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service.ts b/src/rest/ipMessaging/v1/service.ts index 1524d9f613..6bd82ebf2a 100644 --- a/src/rest/ipMessaging/v1/service.ts +++ b/src/rest/ipMessaging/v1/service.ts @@ -279,11 +279,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -296,11 +299,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -486,6 +493,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -858,6 +866,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -899,6 +908,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/channel.ts b/src/rest/ipMessaging/v1/service/channel.ts index 77b3156bb7..bf7a437f86 100644 --- a/src/rest/ipMessaging/v1/service/channel.ts +++ b/src/rest/ipMessaging/v1/service/channel.ts @@ -211,11 +211,14 @@ export class ChannelContextImpl implements ChannelContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -228,11 +231,15 @@ export class ChannelContextImpl implements ChannelContext { fetch( callback?: (error: Error | null, item?: ChannelInstance) => any ): Promise { + 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( @@ -276,6 +283,7 @@ export class ChannelContextImpl implements ChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -652,6 +660,7 @@ export function ChannelListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -703,6 +712,7 @@ export function ChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/channel/invite.ts b/src/rest/ipMessaging/v1/service/channel/invite.ts index 748053b3fb..d1b18782c3 100644 --- a/src/rest/ipMessaging/v1/service/channel/invite.ts +++ b/src/rest/ipMessaging/v1/service/channel/invite.ts @@ -136,11 +136,14 @@ export class InviteContextImpl implements InviteContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -153,11 +156,15 @@ export class InviteContextImpl implements InviteContext { fetch( callback?: (error: Error | null, item?: InviteInstance) => any ): Promise { + 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( @@ -452,6 +459,7 @@ export function InviteListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -501,6 +509,7 @@ export function InviteListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/channel/member.ts b/src/rest/ipMessaging/v1/service/channel/member.ts index 2a3332893e..7e62fa3c83 100644 --- a/src/rest/ipMessaging/v1/service/channel/member.ts +++ b/src/rest/ipMessaging/v1/service/channel/member.ts @@ -169,11 +169,14 @@ export class MemberContextImpl implements MemberContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -186,11 +189,15 @@ export class MemberContextImpl implements MemberContext { fetch( callback?: (error: Error | null, item?: MemberInstance) => any ): Promise { + 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( @@ -232,6 +239,7 @@ export class MemberContextImpl implements MemberContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -572,6 +580,7 @@ export function MemberListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -621,6 +630,7 @@ export function MemberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/channel/message.ts b/src/rest/ipMessaging/v1/service/channel/message.ts index ac792a0e45..f456a6c514 100644 --- a/src/rest/ipMessaging/v1/service/channel/message.ts +++ b/src/rest/ipMessaging/v1/service/channel/message.ts @@ -173,11 +173,14 @@ export class MessageContextImpl implements MessageContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -190,11 +193,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class MessageContextImpl implements MessageContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -582,6 +590,7 @@ export function MessageListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -630,6 +639,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/role.ts b/src/rest/ipMessaging/v1/service/role.ts index 5669ebe563..b4b00a11d7 100644 --- a/src/rest/ipMessaging/v1/service/role.ts +++ b/src/rest/ipMessaging/v1/service/role.ts @@ -145,11 +145,14 @@ export class RoleContextImpl implements RoleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class RoleContextImpl implements RoleContext { fetch( callback?: (error: Error | null, item?: RoleInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class RoleContextImpl implements RoleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -527,6 +535,7 @@ export function RoleListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -573,6 +582,7 @@ export function RoleListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/user.ts b/src/rest/ipMessaging/v1/service/user.ts index 9438d2fa40..ebd6c9eb13 100644 --- a/src/rest/ipMessaging/v1/service/user.ts +++ b/src/rest/ipMessaging/v1/service/user.ts @@ -175,11 +175,14 @@ export class UserContextImpl implements UserContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -192,11 +195,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -239,6 +246,7 @@ export class UserContextImpl implements UserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -591,6 +599,7 @@ export function UserListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -637,6 +646,7 @@ export function UserListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v1/service/user/userChannel.ts b/src/rest/ipMessaging/v1/service/user/userChannel.ts index dc38ca430f..f31c589997 100644 --- a/src/rest/ipMessaging/v1/service/user/userChannel.ts +++ b/src/rest/ipMessaging/v1/service/user/userChannel.ts @@ -187,6 +187,7 @@ export function UserChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/credential.ts b/src/rest/ipMessaging/v2/credential.ts index 86f4255b6f..94fff13799 100644 --- a/src/rest/ipMessaging/v2/credential.ts +++ b/src/rest/ipMessaging/v2/credential.ts @@ -168,11 +168,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -545,6 +553,7 @@ export function CredentialListInstance(version: V2): CredentialListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -586,6 +595,7 @@ export function CredentialListInstance(version: V2): CredentialListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service.ts b/src/rest/ipMessaging/v2/service.ts index caad37b653..63c4284210 100644 --- a/src/rest/ipMessaging/v2/service.ts +++ b/src/rest/ipMessaging/v2/service.ts @@ -242,11 +242,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -259,11 +262,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -384,6 +391,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -775,6 +783,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -816,6 +825,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/binding.ts b/src/rest/ipMessaging/v2/service/binding.ts index 07d7eb7d80..fc41b0220c 100644 --- a/src/rest/ipMessaging/v2/service/binding.ts +++ b/src/rest/ipMessaging/v2/service/binding.ts @@ -125,11 +125,14 @@ export class BindingContextImpl implements BindingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -142,11 +145,15 @@ export class BindingContextImpl implements BindingContext { fetch( callback?: (error: Error | null, item?: BindingInstance) => any ): Promise { + 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( @@ -436,6 +443,7 @@ export function BindingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/channel.ts b/src/rest/ipMessaging/v2/service/channel.ts index 1e03327ca9..f0e541ccd1 100644 --- a/src/rest/ipMessaging/v2/service/channel.ts +++ b/src/rest/ipMessaging/v2/service/channel.ts @@ -298,11 +298,15 @@ export class ChannelContextImpl implements ChannelContext { fetch( callback?: (error: Error | null, item?: ChannelInstance) => any ): Promise { + 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( @@ -352,6 +356,7 @@ export class ChannelContextImpl implements ChannelContext { 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"]; @@ -760,6 +765,7 @@ export function ChannelListInstance( 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"]; @@ -813,6 +819,7 @@ export function ChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/channel/invite.ts b/src/rest/ipMessaging/v2/service/channel/invite.ts index d5e00c6ad1..9c8d929b6f 100644 --- a/src/rest/ipMessaging/v2/service/channel/invite.ts +++ b/src/rest/ipMessaging/v2/service/channel/invite.ts @@ -136,11 +136,14 @@ export class InviteContextImpl implements InviteContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -153,11 +156,15 @@ export class InviteContextImpl implements InviteContext { fetch( callback?: (error: Error | null, item?: InviteInstance) => any ): Promise { + 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( @@ -452,6 +459,7 @@ export function InviteListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -501,6 +509,7 @@ export function InviteListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/channel/member.ts b/src/rest/ipMessaging/v2/service/channel/member.ts index d43b826426..f3fd8cf604 100644 --- a/src/rest/ipMessaging/v2/service/channel/member.ts +++ b/src/rest/ipMessaging/v2/service/channel/member.ts @@ -248,11 +248,15 @@ export class MemberContextImpl implements MemberContext { fetch( callback?: (error: Error | null, item?: MemberInstance) => any ): Promise { + 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( @@ -304,6 +308,7 @@ export class MemberContextImpl implements MemberContext { 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"]; @@ -679,6 +684,7 @@ export function MemberListInstance( 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"]; @@ -730,6 +736,7 @@ export function MemberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/channel/message.ts b/src/rest/ipMessaging/v2/service/channel/message.ts index db3753d0b6..c45915677f 100644 --- a/src/rest/ipMessaging/v2/service/channel/message.ts +++ b/src/rest/ipMessaging/v2/service/channel/message.ts @@ -250,11 +250,15 @@ export class MessageContextImpl implements MessageContext { fetch( callback?: (error: Error | null, item?: MessageInstance) => any ): Promise { + 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( @@ -303,6 +307,7 @@ export class MessageContextImpl implements MessageContext { 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"]; @@ -698,6 +703,7 @@ export function MessageListInstance( 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"]; @@ -748,6 +754,7 @@ export function MessageListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/channel/webhook.ts b/src/rest/ipMessaging/v2/service/channel/webhook.ts index 1212185cfe..bbb8b26e12 100644 --- a/src/rest/ipMessaging/v2/service/channel/webhook.ts +++ b/src/rest/ipMessaging/v2/service/channel/webhook.ts @@ -185,11 +185,14 @@ export class WebhookContextImpl implements WebhookContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -202,11 +205,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -263,6 +270,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -608,6 +616,7 @@ export function WebhookListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -655,6 +664,7 @@ export function WebhookListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/role.ts b/src/rest/ipMessaging/v2/service/role.ts index 64925a0ae2..0c280457d0 100644 --- a/src/rest/ipMessaging/v2/service/role.ts +++ b/src/rest/ipMessaging/v2/service/role.ts @@ -145,11 +145,14 @@ export class RoleContextImpl implements RoleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -162,11 +165,15 @@ export class RoleContextImpl implements RoleContext { fetch( callback?: (error: Error | null, item?: RoleInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class RoleContextImpl implements RoleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -527,6 +535,7 @@ export function RoleListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -573,6 +582,7 @@ export function RoleListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/user.ts b/src/rest/ipMessaging/v2/service/user.ts index 2bdebca268..11764675cc 100644 --- a/src/rest/ipMessaging/v2/service/user.ts +++ b/src/rest/ipMessaging/v2/service/user.ts @@ -195,11 +195,14 @@ export class UserContextImpl implements UserContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -212,11 +215,15 @@ export class UserContextImpl implements UserContext { fetch( callback?: (error: Error | null, item?: UserInstance) => any ): Promise { + 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( @@ -259,6 +266,7 @@ export class UserContextImpl implements UserContext { 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"]; @@ -620,6 +628,7 @@ export function UserListInstance( 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"]; @@ -668,6 +677,7 @@ export function UserListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/user/userBinding.ts b/src/rest/ipMessaging/v2/service/user/userBinding.ts index 6cfacd8a38..625833f64d 100644 --- a/src/rest/ipMessaging/v2/service/user/userBinding.ts +++ b/src/rest/ipMessaging/v2/service/user/userBinding.ts @@ -129,11 +129,14 @@ export class UserBindingContextImpl implements UserBindingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -146,11 +149,15 @@ export class UserBindingContextImpl implements UserBindingContext { fetch( callback?: (error: Error | null, item?: UserBindingInstance) => any ): Promise { + 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( @@ -447,6 +454,7 @@ export function UserBindingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/ipMessaging/v2/service/user/userChannel.ts b/src/rest/ipMessaging/v2/service/user/userChannel.ts index f946ff94c1..81ebe0acec 100644 --- a/src/rest/ipMessaging/v2/service/user/userChannel.ts +++ b/src/rest/ipMessaging/v2/service/user/userChannel.ts @@ -162,11 +162,14 @@ export class UserChannelContextImpl implements UserChannelContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -179,11 +182,15 @@ export class UserChannelContextImpl implements UserChannelContext { fetch( callback?: (error: Error | null, item?: UserChannelInstance) => any ): Promise { + 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( @@ -230,6 +237,7 @@ export class UserChannelContextImpl implements UserChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -564,6 +572,7 @@ export function UserChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/lookups/v1/phoneNumber.ts b/src/rest/lookups/v1/phoneNumber.ts index 328d842460..6ee8604299 100644 --- a/src/rest/lookups/v1/phoneNumber.ts +++ b/src/rest/lookups/v1/phoneNumber.ts @@ -108,6 +108,7 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { }; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/lookups/v2/phoneNumber.ts b/src/rest/lookups/v2/phoneNumber.ts index a9749e2c67..954a6749ba 100644 --- a/src/rest/lookups/v2/phoneNumber.ts +++ b/src/rest/lookups/v2/phoneNumber.ts @@ -149,6 +149,7 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { data["VerificationSid"] = params["verificationSid"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/marketplace/v1/availableAddOn.ts b/src/rest/marketplace/v1/availableAddOn.ts index cf9f00520c..240f8486a8 100644 --- a/src/rest/marketplace/v1/availableAddOn.ts +++ b/src/rest/marketplace/v1/availableAddOn.ts @@ -110,11 +110,15 @@ export class AvailableAddOnContextImpl implements AvailableAddOnContext { fetch( callback?: (error: Error | null, item?: AvailableAddOnInstance) => any ): Promise { + 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( @@ -385,6 +389,7 @@ export function AvailableAddOnListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/marketplace/v1/availableAddOn/availableAddOnExtension.ts b/src/rest/marketplace/v1/availableAddOn/availableAddOnExtension.ts index a7e55e0236..28f5d9df52 100644 --- a/src/rest/marketplace/v1/availableAddOn/availableAddOnExtension.ts +++ b/src/rest/marketplace/v1/availableAddOn/availableAddOnExtension.ts @@ -111,11 +111,15 @@ export class AvailableAddOnExtensionContextImpl item?: AvailableAddOnExtensionInstance ) => any ): Promise { + 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( @@ -399,6 +403,7 @@ export function AvailableAddOnExtensionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/marketplace/v1/installedAddOn.ts b/src/rest/marketplace/v1/installedAddOn.ts index d465cf0836..f41048caf5 100644 --- a/src/rest/marketplace/v1/installedAddOn.ts +++ b/src/rest/marketplace/v1/installedAddOn.ts @@ -177,11 +177,14 @@ export class InstalledAddOnContextImpl implements InstalledAddOnContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -194,11 +197,15 @@ export class InstalledAddOnContextImpl implements InstalledAddOnContext { fetch( callback?: (error: Error | null, item?: InstalledAddOnInstance) => any ): Promise { + 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( @@ -239,6 +246,7 @@ export class InstalledAddOnContextImpl implements InstalledAddOnContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -620,6 +628,7 @@ export function InstalledAddOnListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -661,6 +670,7 @@ export function InstalledAddOnListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/marketplace/v1/installedAddOn/installedAddOnExtension.ts b/src/rest/marketplace/v1/installedAddOn/installedAddOnExtension.ts index 0947c38cc7..6f5d4997f7 100644 --- a/src/rest/marketplace/v1/installedAddOn/installedAddOnExtension.ts +++ b/src/rest/marketplace/v1/installedAddOn/installedAddOnExtension.ts @@ -134,11 +134,15 @@ export class InstalledAddOnExtensionContextImpl item?: InstalledAddOnExtensionInstance ) => any ): Promise { + 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( @@ -179,6 +183,7 @@ export class InstalledAddOnExtensionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -503,6 +508,7 @@ export function InstalledAddOnExtensionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/marketplace/v1/installedAddOn/installedAddOnUsage.ts b/src/rest/marketplace/v1/installedAddOn/installedAddOnUsage.ts index 7c1535c210..e23721304f 100644 --- a/src/rest/marketplace/v1/installedAddOn/installedAddOnUsage.ts +++ b/src/rest/marketplace/v1/installedAddOn/installedAddOnUsage.ts @@ -22,8 +22,8 @@ export class MarketplaceV1InstalledAddOnInstalledAddOnUsage { /** * Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. */ - "totalSubmitted"?: number; - "billableItems": Array; + "total_submitted"?: number; + "billable_items": Array; } export class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems { @@ -62,12 +62,14 @@ export interface InstalledAddOnUsageListInstance { * Create a InstalledAddOnUsageInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnUsageInstance */ create( params: MarketplaceV1InstalledAddOnInstalledAddOnUsage, + headers?: any, callback?: (error: Error | null, item?: InstalledAddOnUsageInstance) => any ): Promise; @@ -94,6 +96,7 @@ export function InstalledAddOnUsageListInstance( instance.create = function create( params: MarketplaceV1InstalledAddOnInstalledAddOnUsage, + headers?: any, callback?: (error: Error | null, items: InstalledAddOnUsageInstance) => any ): Promise { if (params === null || params === undefined) { @@ -104,8 +107,12 @@ export function InstalledAddOnUsageListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/marketplace/v1/moduleDataManagement.ts b/src/rest/marketplace/v1/moduleDataManagement.ts index f25162134e..15c7642b88 100644 --- a/src/rest/marketplace/v1/moduleDataManagement.ts +++ b/src/rest/marketplace/v1/moduleDataManagement.ts @@ -102,11 +102,15 @@ export class ModuleDataManagementContextImpl fetch( callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any ): Promise { + 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( @@ -154,6 +158,7 @@ export class ModuleDataManagementContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/marketplace/v1/referralConversion.ts b/src/rest/marketplace/v1/referralConversion.ts index 8e9ef9716a..9515da01ed 100644 --- a/src/rest/marketplace/v1/referralConversion.ts +++ b/src/rest/marketplace/v1/referralConversion.ts @@ -19,28 +19,36 @@ const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; export class CreateReferralConversionRequest { - "referralAccountSid"?: string; + "referral_account_sid"?: string; } /** * Options to pass to create a ReferralConversionInstance */ -export interface ReferralConversionContextCreateOptions { +export interface ReferralConversionListInstanceCreateOptions { /** */ createReferralConversionRequest: CreateReferralConversionRequest; } -export interface ReferralConversionContext { +export interface ReferralConversionSolution {} + +export interface ReferralConversionListInstance { + _version: V1; + _solution: ReferralConversionSolution; + _uri: string; + /** * Create a ReferralConversionInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ReferralConversionInstance */ create( params: CreateReferralConversionRequest, + headers?: any, callback?: (error: Error | null, item?: ReferralConversionInstance) => any ): Promise; @@ -51,22 +59,19 @@ export interface ReferralConversionContext { [inspect.custom](_depth: any, options: InspectOptions): any; } -export interface ReferralConversionContextSolution {} - -export class ReferralConversionContextImpl - implements ReferralConversionContext -{ - protected _solution: ReferralConversionContextSolution; - protected _uri: string; +export function ReferralConversionListInstance( + version: V1 +): ReferralConversionListInstance { + const instance = {} as ReferralConversionListInstance; - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/ReferralConversion`; - } + instance._version = version; + instance._solution = {}; + instance._uri = `/ReferralConversion`; - create( + instance.create = function create( params: CreateReferralConversionRequest, - callback?: (error: Error | null, item?: ReferralConversionInstance) => any + headers?: any, + callback?: (error: Error | null, items: ReferralConversionInstance) => any ): Promise { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); @@ -76,11 +81,14 @@ export class ReferralConversionContextImpl data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; - const instance = this; - let operationVersion = instance._version, + let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", @@ -97,20 +105,20 @@ export class ReferralConversionContextImpl callback ); return operationPromise; - } + }; - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return this._solution; - } + instance.toJSON = function toJSON() { + return instance._solution; + }; - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; } interface ReferralConversionPayload extends ReferralConversionResource {} @@ -120,43 +128,12 @@ interface ReferralConversionResource { } export class ReferralConversionInstance { - protected _solution: ReferralConversionContextSolution; - protected _context?: ReferralConversionContext; - constructor(protected _version: V1, payload: ReferralConversionResource) { this.convertedAccountSid = payload.converted_account_sid; - - this._solution = {}; } convertedAccountSid: string; - private get _proxy(): ReferralConversionContext { - this._context = - this._context || new ReferralConversionContextImpl(this._version); - return this._context; - } - - /** - * Create a ReferralConversionInstance - * - * @param params - Body for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ReferralConversionInstance - */ - create( - params: CreateReferralConversionRequest, - callback?: (error: Error | null, item?: ReferralConversionInstance) => any - ): Promise; - - create( - params?: any, - callback?: (error: Error | null, item?: ReferralConversionInstance) => any - ): Promise { - return this._proxy.create(params, callback); - } - /** * Provide a user-friendly representation * @@ -172,47 +149,3 @@ export class ReferralConversionInstance { return inspect(this.toJSON(), options); } } - -export interface ReferralConversionSolution {} - -export interface ReferralConversionListInstance { - _version: V1; - _solution: ReferralConversionSolution; - _uri: string; - - (): ReferralConversionContext; - get(): ReferralConversionContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function ReferralConversionListInstance( - version: V1 -): ReferralConversionListInstance { - const instance = (() => instance.get()) as ReferralConversionListInstance; - - instance.get = function get(): ReferralConversionContext { - return new ReferralConversionContextImpl(version); - }; - - instance._version = version; - instance._solution = {}; - instance._uri = ``; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} diff --git a/src/rest/messaging/V1.ts b/src/rest/messaging/V1.ts index 23bdb7aab0..edbd5398c3 100644 --- a/src/rest/messaging/V1.ts +++ b/src/rest/messaging/V1.ts @@ -22,6 +22,7 @@ import { DomainConfigMessagingServiceListInstance } from "./v1/domainConfigMessa import { ExternalCampaignListInstance } from "./v1/externalCampaign"; import { LinkshorteningMessagingServiceListInstance } from "./v1/linkshorteningMessagingService"; import { LinkshorteningMessagingServiceDomainAssociationListInstance } from "./v1/linkshorteningMessagingServiceDomainAssociation"; +import { RequestManagedCertListInstance } from "./v1/requestManagedCert"; import { ServiceListInstance } from "./v1/service"; import { TollfreeVerificationListInstance } from "./v1/tollfreeVerification"; import { UsecaseListInstance } from "./v1/usecase"; @@ -52,6 +53,8 @@ export default class V1 extends Version { protected _linkshorteningMessagingService?: LinkshorteningMessagingServiceListInstance; /** linkshorteningMessagingServiceDomainAssociation - { Twilio.Messaging.V1.LinkshorteningMessagingServiceDomainAssociationListInstance } resource */ protected _linkshorteningMessagingServiceDomainAssociation?: LinkshorteningMessagingServiceDomainAssociationListInstance; + /** requestManagedCert - { Twilio.Messaging.V1.RequestManagedCertListInstance } resource */ + protected _requestManagedCert?: RequestManagedCertListInstance; /** services - { Twilio.Messaging.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** tollfreeVerifications - { Twilio.Messaging.V1.TollfreeVerificationListInstance } resource */ @@ -116,6 +119,13 @@ export default class V1 extends Version { return this._linkshorteningMessagingServiceDomainAssociation; } + /** Getter for requestManagedCert resource */ + get requestManagedCert(): RequestManagedCertListInstance { + this._requestManagedCert = + this._requestManagedCert || RequestManagedCertListInstance(this); + return this._requestManagedCert; + } + /** Getter for services resource */ get services(): ServiceListInstance { this._services = this._services || ServiceListInstance(this); diff --git a/src/rest/messaging/v1/brandRegistration.ts b/src/rest/messaging/v1/brandRegistration.ts index f86034cec6..93480ac4c6 100644 --- a/src/rest/messaging/v1/brandRegistration.ts +++ b/src/rest/messaging/v1/brandRegistration.ts @@ -166,11 +166,15 @@ export class BrandRegistrationContextImpl implements BrandRegistrationContext { fetch( callback?: (error: Error | null, item?: BrandRegistrationInstance) => any ): Promise { + 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( @@ -192,11 +196,15 @@ export class BrandRegistrationContextImpl implements BrandRegistrationContext { update( callback?: (error: Error | null, item?: BrandRegistrationInstance) => any ): Promise { + 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( @@ -611,6 +619,7 @@ export function BrandRegistrationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -652,6 +661,7 @@ export function BrandRegistrationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts b/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts index 8914219629..a628c4e5ff 100644 --- a/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts +++ b/src/rest/messaging/v1/brandRegistration/brandRegistrationOtp.ts @@ -62,10 +62,14 @@ export function BrandRegistrationOtpListInstance( instance.create = function create( callback?: (error: Error | null, items: BrandRegistrationOtpInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", + headers, }); operationPromise = operationPromise.then( diff --git a/src/rest/messaging/v1/brandRegistration/brandVetting.ts b/src/rest/messaging/v1/brandRegistration/brandVetting.ts index 594e736815..aa182afe82 100644 --- a/src/rest/messaging/v1/brandRegistration/brandVetting.ts +++ b/src/rest/messaging/v1/brandRegistration/brandVetting.ts @@ -121,11 +121,15 @@ export class BrandVettingContextImpl implements BrandVettingContext { fetch( callback?: (error: Error | null, item?: BrandVettingInstance) => any ): Promise { + 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( @@ -435,6 +439,7 @@ export function BrandVettingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -483,6 +488,7 @@ export function BrandVettingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/deactivations.ts b/src/rest/messaging/v1/deactivations.ts index 46366c441d..e96e47baca 100644 --- a/src/rest/messaging/v1/deactivations.ts +++ b/src/rest/messaging/v1/deactivations.ts @@ -87,6 +87,7 @@ export class DeactivationsContextImpl implements DeactivationsContext { data["Date"] = serialize.iso8601Date(params["date"]); const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/messaging/v1/domainCerts.ts b/src/rest/messaging/v1/domainCerts.ts index 900aa2dd52..fb5382de30 100644 --- a/src/rest/messaging/v1/domainCerts.ts +++ b/src/rest/messaging/v1/domainCerts.ts @@ -89,11 +89,14 @@ export class DomainCertsContextImpl implements DomainCertsContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -106,11 +109,15 @@ export class DomainCertsContextImpl implements DomainCertsContext { fetch( callback?: (error: Error | null, item?: DomainCertsInstance) => any ): Promise { + 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( @@ -147,6 +154,7 @@ export class DomainCertsContextImpl implements DomainCertsContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/messaging/v1/domainConfig.ts b/src/rest/messaging/v1/domainConfig.ts index b63ae3e992..3b23766d14 100644 --- a/src/rest/messaging/v1/domainConfig.ts +++ b/src/rest/messaging/v1/domainConfig.ts @@ -94,11 +94,15 @@ export class DomainConfigContextImpl implements DomainConfigContext { fetch( callback?: (error: Error | null, item?: DomainConfigInstance) => any ): Promise { + 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( @@ -143,6 +147,7 @@ export class DomainConfigContextImpl implements DomainConfigContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/messaging/v1/domainConfigMessagingService.ts b/src/rest/messaging/v1/domainConfigMessagingService.ts index 77812c0beb..005a66da25 100644 --- a/src/rest/messaging/v1/domainConfigMessagingService.ts +++ b/src/rest/messaging/v1/domainConfigMessagingService.ts @@ -65,11 +65,15 @@ export class DomainConfigMessagingServiceContextImpl item?: DomainConfigMessagingServiceInstance ) => any ): Promise { + 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( diff --git a/src/rest/messaging/v1/externalCampaign.ts b/src/rest/messaging/v1/externalCampaign.ts index 5413dc9264..789569bac8 100644 --- a/src/rest/messaging/v1/externalCampaign.ts +++ b/src/rest/messaging/v1/externalCampaign.ts @@ -97,6 +97,7 @@ export function ExternalCampaignListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/messaging/v1/linkshorteningMessagingService.ts b/src/rest/messaging/v1/linkshorteningMessagingService.ts index ea191b5bf4..8c98b68b14 100644 --- a/src/rest/messaging/v1/linkshorteningMessagingService.ts +++ b/src/rest/messaging/v1/linkshorteningMessagingService.ts @@ -85,11 +85,15 @@ export class LinkshorteningMessagingServiceContextImpl item?: LinkshorteningMessagingServiceInstance ) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", + headers, }); operationPromise = operationPromise.then( @@ -112,11 +116,14 @@ export class LinkshorteningMessagingServiceContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( diff --git a/src/rest/messaging/v1/linkshorteningMessagingServiceDomainAssociation.ts b/src/rest/messaging/v1/linkshorteningMessagingServiceDomainAssociation.ts index 4527d0c8b8..81041fa300 100644 --- a/src/rest/messaging/v1/linkshorteningMessagingServiceDomainAssociation.ts +++ b/src/rest/messaging/v1/linkshorteningMessagingServiceDomainAssociation.ts @@ -65,11 +65,15 @@ export class LinkshorteningMessagingServiceDomainAssociationContextImpl item?: LinkshorteningMessagingServiceDomainAssociationInstance ) => any ): Promise { + 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( diff --git a/src/rest/messaging/v1/requestManagedCert.ts b/src/rest/messaging/v1/requestManagedCert.ts new file mode 100644 index 0000000000..8e75ec305f --- /dev/null +++ b/src/rest/messaging/v1/requestManagedCert.ts @@ -0,0 +1,263 @@ +/* + * 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 RequestManagedCertContext { + /** + * Update a RequestManagedCertInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed RequestManagedCertInstance + */ + update( + callback?: (error: Error | null, item?: RequestManagedCertInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface RequestManagedCertContextSolution { + domainSid: string; +} + +export class RequestManagedCertContextImpl + implements RequestManagedCertContext +{ + protected _solution: RequestManagedCertContextSolution; + protected _uri: string; + + constructor(protected _version: V1, domainSid: string) { + if (!isValidPathParam(domainSid)) { + throw new Error("Parameter 'domainSid' is not valid."); + } + + this._solution = { domainSid }; + this._uri = `/LinkShortening/Domains/${domainSid}/RequestManagedCert`; + } + + update( + callback?: (error: Error | null, item?: RequestManagedCertInstance) => any + ): Promise { + 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( + (payload) => + new RequestManagedCertInstance( + operationVersion, + payload, + instance._solution.domainSid + ) + ); + + 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 RequestManagedCertPayload extends RequestManagedCertResource {} + +interface RequestManagedCertResource { + domain_sid: string; + date_updated: Date; + date_created: Date; + date_expires: Date; + domain_name: string; + certificate_sid: string; + url: string; + managed: boolean; + requesting: boolean; +} + +export class RequestManagedCertInstance { + protected _solution: RequestManagedCertContextSolution; + protected _context?: RequestManagedCertContext; + + constructor( + protected _version: V1, + payload: RequestManagedCertResource, + domainSid?: string + ) { + this.domainSid = payload.domain_sid; + this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); + this.dateCreated = deserialize.iso8601DateTime(payload.date_created); + this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); + this.domainName = payload.domain_name; + this.certificateSid = payload.certificate_sid; + this.url = payload.url; + this.managed = payload.managed; + this.requesting = payload.requesting; + + this._solution = { domainSid: domainSid || this.domainSid }; + } + + /** + * The unique string that we created to identify the Domain resource. + */ + domainSid: string; + /** + * Date that this Domain was last updated. + */ + dateUpdated: Date; + /** + * Date that this Domain was registered to the Twilio platform to create a new Domain object. + */ + dateCreated: Date; + /** + * Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert. + */ + dateExpires: Date; + /** + * Full url path for this domain. + */ + domainName: string; + /** + * The unique string that we created to identify this Certificate resource. + */ + certificateSid: string; + url: string; + /** + * A boolean flag indicating if the certificate is managed by Twilio. + */ + managed: boolean; + /** + * A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio. + */ + requesting: boolean; + + private get _proxy(): RequestManagedCertContext { + this._context = + this._context || + new RequestManagedCertContextImpl( + this._version, + this._solution.domainSid + ); + return this._context; + } + + /** + * Update a RequestManagedCertInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed RequestManagedCertInstance + */ + update( + callback?: (error: Error | null, item?: RequestManagedCertInstance) => any + ): Promise { + return this._proxy.update(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + domainSid: this.domainSid, + dateUpdated: this.dateUpdated, + dateCreated: this.dateCreated, + dateExpires: this.dateExpires, + domainName: this.domainName, + certificateSid: this.certificateSid, + url: this.url, + managed: this.managed, + requesting: this.requesting, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface RequestManagedCertSolution {} + +export interface RequestManagedCertListInstance { + _version: V1; + _solution: RequestManagedCertSolution; + _uri: string; + + (domainSid: string): RequestManagedCertContext; + get(domainSid: string): RequestManagedCertContext; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function RequestManagedCertListInstance( + version: V1 +): RequestManagedCertListInstance { + const instance = ((domainSid) => + instance.get(domainSid)) as RequestManagedCertListInstance; + + instance.get = function get(domainSid): RequestManagedCertContext { + return new RequestManagedCertContextImpl(version, domainSid); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = ``; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} diff --git a/src/rest/messaging/v1/service.ts b/src/rest/messaging/v1/service.ts index f0addca520..db1066e194 100644 --- a/src/rest/messaging/v1/service.ts +++ b/src/rest/messaging/v1/service.ts @@ -268,11 +268,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -285,11 +288,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -357,6 +364,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -852,6 +860,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -893,6 +902,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/service/alphaSender.ts b/src/rest/messaging/v1/service/alphaSender.ts index fd4cd70c81..e65fcbbea1 100644 --- a/src/rest/messaging/v1/service/alphaSender.ts +++ b/src/rest/messaging/v1/service/alphaSender.ts @@ -118,11 +118,14 @@ export class AlphaSenderContextImpl implements AlphaSenderContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -135,11 +138,15 @@ export class AlphaSenderContextImpl implements AlphaSenderContext { fetch( callback?: (error: Error | null, item?: AlphaSenderInstance) => any ): Promise { + 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( @@ -440,6 +447,7 @@ export function AlphaSenderListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -486,6 +494,7 @@ export function AlphaSenderListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/service/channelSender.ts b/src/rest/messaging/v1/service/channelSender.ts index 103b724760..86cefe2995 100644 --- a/src/rest/messaging/v1/service/channelSender.ts +++ b/src/rest/messaging/v1/service/channelSender.ts @@ -122,11 +122,14 @@ export class ChannelSenderContextImpl implements ChannelSenderContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -139,11 +142,15 @@ export class ChannelSenderContextImpl implements ChannelSenderContext { fetch( callback?: (error: Error | null, item?: ChannelSenderInstance) => any ): Promise { + 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( @@ -457,6 +464,7 @@ export function ChannelSenderListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -503,6 +511,7 @@ export function ChannelSenderListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/service/phoneNumber.ts b/src/rest/messaging/v1/service/phoneNumber.ts index 4bea8d6ea3..e0d6d6b4b8 100644 --- a/src/rest/messaging/v1/service/phoneNumber.ts +++ b/src/rest/messaging/v1/service/phoneNumber.ts @@ -118,11 +118,14 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -135,11 +138,15 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { fetch( callback?: (error: Error | null, item?: PhoneNumberInstance) => any ): Promise { + 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( @@ -452,6 +459,7 @@ export function PhoneNumberListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -498,6 +506,7 @@ export function PhoneNumberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/service/shortCode.ts b/src/rest/messaging/v1/service/shortCode.ts index 081ddf7177..eb52900c59 100644 --- a/src/rest/messaging/v1/service/shortCode.ts +++ b/src/rest/messaging/v1/service/shortCode.ts @@ -118,11 +118,14 @@ export class ShortCodeContextImpl implements ShortCodeContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -135,11 +138,15 @@ export class ShortCodeContextImpl implements ShortCodeContext { fetch( callback?: (error: Error | null, item?: ShortCodeInstance) => any ): Promise { + 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( @@ -450,6 +457,7 @@ export function ShortCodeListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -496,6 +504,7 @@ export function ShortCodeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/service/usAppToPerson.ts b/src/rest/messaging/v1/service/usAppToPerson.ts index a230c6f2f4..470bcd1ddf 100644 --- a/src/rest/messaging/v1/service/usAppToPerson.ts +++ b/src/rest/messaging/v1/service/usAppToPerson.ts @@ -185,11 +185,14 @@ export class UsAppToPersonContextImpl implements UsAppToPersonContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -202,11 +205,15 @@ export class UsAppToPersonContextImpl implements UsAppToPersonContext { fetch( callback?: (error: Error | null, item?: UsAppToPersonInstance) => any ): Promise { + 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( @@ -303,6 +310,7 @@ export class UsAppToPersonContextImpl implements UsAppToPersonContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -868,6 +876,7 @@ export function UsAppToPersonListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -914,6 +923,7 @@ export function UsAppToPersonListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/service/usAppToPersonUsecase.ts b/src/rest/messaging/v1/service/usAppToPersonUsecase.ts index 8bca92e439..8b2e7875d2 100644 --- a/src/rest/messaging/v1/service/usAppToPersonUsecase.ts +++ b/src/rest/messaging/v1/service/usAppToPersonUsecase.ts @@ -98,6 +98,7 @@ export function UsAppToPersonUsecaseListInstance( data["BrandRegistrationSid"] = params["brandRegistrationSid"]; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.fetch({ diff --git a/src/rest/messaging/v1/tollfreeVerification.ts b/src/rest/messaging/v1/tollfreeVerification.ts index 221ef29fa3..65b4142736 100644 --- a/src/rest/messaging/v1/tollfreeVerification.ts +++ b/src/rest/messaging/v1/tollfreeVerification.ts @@ -271,11 +271,14 @@ export class TollfreeVerificationContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -288,11 +291,15 @@ export class TollfreeVerificationContextImpl fetch( callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any ): Promise { + 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( @@ -378,6 +385,7 @@ export class TollfreeVerificationContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -1043,6 +1051,7 @@ export function TollfreeVerificationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -1091,6 +1100,7 @@ export function TollfreeVerificationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/messaging/v1/usecase.ts b/src/rest/messaging/v1/usecase.ts index d67020fcdb..9b08dce380 100644 --- a/src/rest/messaging/v1/usecase.ts +++ b/src/rest/messaging/v1/usecase.ts @@ -53,10 +53,14 @@ export function UsecaseListInstance(version: V1): UsecaseListInstance { instance.fetch = function fetch( callback?: (error: Error | null, items: UsecaseInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", + headers, }); operationPromise = operationPromise.then( diff --git a/src/rest/microvisor/v1/accountConfig.ts b/src/rest/microvisor/v1/accountConfig.ts index 1852649550..e08eaa3b8f 100644 --- a/src/rest/microvisor/v1/accountConfig.ts +++ b/src/rest/microvisor/v1/accountConfig.ts @@ -136,11 +136,14 @@ export class AccountConfigContextImpl implements AccountConfigContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -153,11 +156,15 @@ export class AccountConfigContextImpl implements AccountConfigContext { fetch( callback?: (error: Error | null, item?: AccountConfigInstance) => any ): Promise { + 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( @@ -194,6 +201,7 @@ export class AccountConfigContextImpl implements AccountConfigContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -490,6 +498,7 @@ export function AccountConfigListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -531,6 +540,7 @@ export function AccountConfigListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/microvisor/v1/accountSecret.ts b/src/rest/microvisor/v1/accountSecret.ts index cdd13d29f3..9ed558d0e5 100644 --- a/src/rest/microvisor/v1/accountSecret.ts +++ b/src/rest/microvisor/v1/accountSecret.ts @@ -136,11 +136,14 @@ export class AccountSecretContextImpl implements AccountSecretContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -153,11 +156,15 @@ export class AccountSecretContextImpl implements AccountSecretContext { fetch( callback?: (error: Error | null, item?: AccountSecretInstance) => any ): Promise { + 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( @@ -194,6 +201,7 @@ export class AccountSecretContextImpl implements AccountSecretContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -483,6 +491,7 @@ export function AccountSecretListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -524,6 +533,7 @@ export function AccountSecretListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/microvisor/v1/app.ts b/src/rest/microvisor/v1/app.ts index a7c01ebd81..b1717cca36 100644 --- a/src/rest/microvisor/v1/app.ts +++ b/src/rest/microvisor/v1/app.ts @@ -118,11 +118,14 @@ export class AppContextImpl implements AppContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -135,11 +138,15 @@ export class AppContextImpl implements AppContext { fetch( callback?: (error: Error | null, item?: AppInstance) => any ): Promise { + 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( @@ -410,6 +417,7 @@ export function AppListInstance(version: V1): AppListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/microvisor/v1/app/appManifest.ts b/src/rest/microvisor/v1/app/appManifest.ts index feb4a1b43a..48ce270f97 100644 --- a/src/rest/microvisor/v1/app/appManifest.ts +++ b/src/rest/microvisor/v1/app/appManifest.ts @@ -57,11 +57,15 @@ export class AppManifestContextImpl implements AppManifestContext { fetch( callback?: (error: Error | null, item?: AppManifestInstance) => any ): Promise { + 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( diff --git a/src/rest/microvisor/v1/device.ts b/src/rest/microvisor/v1/device.ts index 147943b917..b08f880f6e 100644 --- a/src/rest/microvisor/v1/device.ts +++ b/src/rest/microvisor/v1/device.ts @@ -153,11 +153,15 @@ export class DeviceContextImpl implements DeviceContext { fetch( callback?: (error: Error | null, item?: DeviceInstance) => any ): Promise { + 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( @@ -198,6 +202,7 @@ export class DeviceContextImpl implements DeviceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -510,6 +515,7 @@ export function DeviceListInstance(version: V1): DeviceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/microvisor/v1/device/deviceConfig.ts b/src/rest/microvisor/v1/device/deviceConfig.ts index 4d83dc334c..d2ccc54cc8 100644 --- a/src/rest/microvisor/v1/device/deviceConfig.ts +++ b/src/rest/microvisor/v1/device/deviceConfig.ts @@ -141,11 +141,14 @@ export class DeviceConfigContextImpl implements DeviceConfigContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -158,11 +161,15 @@ export class DeviceConfigContextImpl implements DeviceConfigContext { fetch( callback?: (error: Error | null, item?: DeviceConfigInstance) => any ): Promise { + 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( @@ -200,6 +207,7 @@ export class DeviceConfigContextImpl implements DeviceConfigContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -510,6 +518,7 @@ export function DeviceConfigListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -556,6 +565,7 @@ export function DeviceConfigListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/microvisor/v1/device/deviceSecret.ts b/src/rest/microvisor/v1/device/deviceSecret.ts index 34caca5ad8..3ac2ef0a77 100644 --- a/src/rest/microvisor/v1/device/deviceSecret.ts +++ b/src/rest/microvisor/v1/device/deviceSecret.ts @@ -141,11 +141,14 @@ export class DeviceSecretContextImpl implements DeviceSecretContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -158,11 +161,15 @@ export class DeviceSecretContextImpl implements DeviceSecretContext { fetch( callback?: (error: Error | null, item?: DeviceSecretInstance) => any ): Promise { + 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( @@ -200,6 +207,7 @@ export class DeviceSecretContextImpl implements DeviceSecretContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -503,6 +511,7 @@ export function DeviceSecretListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -549,6 +558,7 @@ export function DeviceSecretListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/monitor/v1/alert.ts b/src/rest/monitor/v1/alert.ts index 23f612f68f..fcd38ac01d 100644 --- a/src/rest/monitor/v1/alert.ts +++ b/src/rest/monitor/v1/alert.ts @@ -113,11 +113,15 @@ export class AlertContextImpl implements AlertContext { fetch( callback?: (error: Error | null, item?: AlertInstance) => any ): Promise { + 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( @@ -453,6 +457,7 @@ export function AlertListInstance(version: V1): AlertListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/monitor/v1/event.ts b/src/rest/monitor/v1/event.ts index b6b096be78..01c7e94b80 100644 --- a/src/rest/monitor/v1/event.ts +++ b/src/rest/monitor/v1/event.ts @@ -131,11 +131,15 @@ export class EventContextImpl implements EventContext { fetch( callback?: (error: Error | null, item?: EventInstance) => any ): Promise { + 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( @@ -442,6 +446,7 @@ export function EventListInstance(version: V1): EventListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/notify/v1/credential.ts b/src/rest/notify/v1/credential.ts index 9e0371dcba..7cecb2ced7 100644 --- a/src/rest/notify/v1/credential.ts +++ b/src/rest/notify/v1/credential.ts @@ -168,11 +168,14 @@ export class CredentialContextImpl implements CredentialContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class CredentialContextImpl implements CredentialContext { fetch( callback?: (error: Error | null, item?: CredentialInstance) => any ): Promise { + 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( @@ -236,6 +243,7 @@ export class CredentialContextImpl implements CredentialContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -566,6 +574,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -607,6 +616,7 @@ export function CredentialListInstance(version: V1): CredentialListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/notify/v1/service.ts b/src/rest/notify/v1/service.ts index 9e008d5fbd..5fbdd0d83d 100644 --- a/src/rest/notify/v1/service.ts +++ b/src/rest/notify/v1/service.ts @@ -223,11 +223,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -240,11 +243,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -311,6 +318,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -776,6 +784,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -819,6 +828,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/notify/v1/service/binding.ts b/src/rest/notify/v1/service/binding.ts index 8b9d567036..8899484dd9 100644 --- a/src/rest/notify/v1/service/binding.ts +++ b/src/rest/notify/v1/service/binding.ts @@ -162,11 +162,14 @@ export class BindingContextImpl implements BindingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -179,11 +182,15 @@ export class BindingContextImpl implements BindingContext { fetch( callback?: (error: Error | null, item?: BindingInstance) => any ): Promise { + 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( @@ -546,6 +553,7 @@ export function BindingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -600,6 +608,7 @@ export function BindingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/notify/v1/service/notification.ts b/src/rest/notify/v1/service/notification.ts index 1ffb83cdbd..c29d2a96b9 100644 --- a/src/rest/notify/v1/service/notification.ts +++ b/src/rest/notify/v1/service/notification.ts @@ -163,6 +163,7 @@ export function NotificationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/V1.ts b/src/rest/numbers/V1.ts index af82776f7a..148a24ce40 100644 --- a/src/rest/numbers/V1.ts +++ b/src/rest/numbers/V1.ts @@ -21,8 +21,8 @@ import { PortingPortInPhoneNumberListInstance } from "./v1/portingPortInPhoneNum import { PortingPortabilityListInstance } from "./v1/portingPortability"; import { PortingWebhookConfigurationListInstance } from "./v1/portingWebhookConfiguration"; import { PortingWebhookConfigurationDeleteListInstance } from "./v1/portingWebhookConfigurationDelete"; -import { PortingWebhookConfigurationFetchListInstance } from "./v1/portingWebhookConfigurationFetch"; import { SigningRequestConfigurationListInstance } from "./v1/signingRequestConfiguration"; +import { WebhookListInstance } from "./v1/webhook"; export default class V1 extends Version { /** @@ -48,10 +48,10 @@ export default class V1 extends Version { protected _portingWebhookConfigurations?: PortingWebhookConfigurationListInstance; /** portingWebhookConfigurationsDelete - { Twilio.Numbers.V1.PortingWebhookConfigurationDeleteListInstance } resource */ protected _portingWebhookConfigurationsDelete?: PortingWebhookConfigurationDeleteListInstance; - /** portingWebhookConfigurationFetch - { Twilio.Numbers.V1.PortingWebhookConfigurationFetchListInstance } resource */ - protected _portingWebhookConfigurationFetch?: PortingWebhookConfigurationFetchListInstance; /** signingRequestConfigurations - { Twilio.Numbers.V1.SigningRequestConfigurationListInstance } resource */ protected _signingRequestConfigurations?: SigningRequestConfigurationListInstance; + /** webhook - { Twilio.Numbers.V1.WebhookListInstance } resource */ + protected _webhook?: WebhookListInstance; /** Getter for bulkEligibilities resource */ get bulkEligibilities(): BulkEligibilityListInstance { @@ -104,14 +104,6 @@ export default class V1 extends Version { return this._portingWebhookConfigurationsDelete; } - /** Getter for portingWebhookConfigurationFetch resource */ - get portingWebhookConfigurationFetch(): PortingWebhookConfigurationFetchListInstance { - this._portingWebhookConfigurationFetch = - this._portingWebhookConfigurationFetch || - PortingWebhookConfigurationFetchListInstance(this); - return this._portingWebhookConfigurationFetch; - } - /** Getter for signingRequestConfigurations resource */ get signingRequestConfigurations(): SigningRequestConfigurationListInstance { this._signingRequestConfigurations = @@ -119,4 +111,10 @@ export default class V1 extends Version { SigningRequestConfigurationListInstance(this); return this._signingRequestConfigurations; } + + /** Getter for webhook resource */ + get webhook(): WebhookListInstance { + this._webhook = this._webhook || WebhookListInstance(this); + return this._webhook; + } } diff --git a/src/rest/numbers/v1/bulkEligibility.ts b/src/rest/numbers/v1/bulkEligibility.ts index 64290c3d8b..085bc46acb 100644 --- a/src/rest/numbers/v1/bulkEligibility.ts +++ b/src/rest/numbers/v1/bulkEligibility.ts @@ -65,11 +65,15 @@ export class BulkEligibilityContextImpl implements BulkEligibilityContext { fetch( callback?: (error: Error | null, item?: BulkEligibilityInstance) => any ): Promise { + 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( @@ -223,12 +227,14 @@ export interface BulkEligibilityListInstance { * Create a BulkEligibilityInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkEligibilityInstance */ create( params: object, + headers?: any, callback?: (error: Error | null, item?: BulkEligibilityInstance) => any ): Promise; @@ -257,6 +263,7 @@ export function BulkEligibilityListInstance( params?: | object | ((error: Error | null, items: BulkEligibilityInstance) => any), + headers?: any, callback?: (error: Error | null, items: BulkEligibilityInstance) => any ): Promise { if (params instanceof Function) { @@ -270,8 +277,12 @@ export function BulkEligibilityListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/v1/eligibility.ts b/src/rest/numbers/v1/eligibility.ts index f57647a5b9..519efac96f 100644 --- a/src/rest/numbers/v1/eligibility.ts +++ b/src/rest/numbers/v1/eligibility.ts @@ -47,12 +47,14 @@ export interface EligibilityListInstance { * Create a EligibilityInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EligibilityInstance */ create( params: object, + headers?: any, callback?: (error: Error | null, item?: EligibilityInstance) => any ): Promise; @@ -74,6 +76,7 @@ export function EligibilityListInstance(version: V1): EligibilityListInstance { params?: | object | ((error: Error | null, items: EligibilityInstance) => any), + headers?: any, callback?: (error: Error | null, items: EligibilityInstance) => any ): Promise { if (params instanceof Function) { @@ -87,8 +90,12 @@ export function EligibilityListInstance(version: V1): EligibilityListInstance { data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/v1/portingPortIn.ts b/src/rest/numbers/v1/portingPortIn.ts index 5bb3273933..6246a1d2b2 100644 --- a/src/rest/numbers/v1/portingPortIn.ts +++ b/src/rest/numbers/v1/portingPortIn.ts @@ -76,11 +76,14 @@ export class PortingPortInContextImpl implements PortingPortInContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -93,11 +96,15 @@ export class PortingPortInContextImpl implements PortingPortInContext { fetch( callback?: (error: Error | null, item?: PortingPortInInstance) => any ): Promise { + 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( @@ -306,12 +313,14 @@ export interface PortingPortInListInstance { * Create a PortingPortInInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInInstance */ create( params: object, + headers?: any, callback?: (error: Error | null, item?: PortingPortInInstance) => any ): Promise; @@ -340,6 +349,7 @@ export function PortingPortInListInstance( params?: | object | ((error: Error | null, items: PortingPortInInstance) => any), + headers?: any, callback?: (error: Error | null, items: PortingPortInInstance) => any ): Promise { if (params instanceof Function) { @@ -353,8 +363,12 @@ export function PortingPortInListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/v1/portingPortInPhoneNumber.ts b/src/rest/numbers/v1/portingPortInPhoneNumber.ts index 6a285913e0..bf21c19f97 100644 --- a/src/rest/numbers/v1/portingPortInPhoneNumber.ts +++ b/src/rest/numbers/v1/portingPortInPhoneNumber.ts @@ -82,11 +82,14 @@ export class PortingPortInPhoneNumberContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -102,11 +105,15 @@ export class PortingPortInPhoneNumberContextImpl item?: PortingPortInPhoneNumberInstance ) => any ): Promise { + 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( diff --git a/src/rest/numbers/v1/portingPortability.ts b/src/rest/numbers/v1/portingPortability.ts index 8bc592156c..e7bf482c7e 100644 --- a/src/rest/numbers/v1/portingPortability.ts +++ b/src/rest/numbers/v1/portingPortability.ts @@ -30,6 +30,8 @@ export type PortingPortabilityNumberType = export interface PortingPortabilityContextFetchOptions { /** Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. */ targetAccountSid?: string; + /** Address Sid of customer to which the number will be ported. */ + addressSid?: string; } export interface PortingPortabilityContext { @@ -99,8 +101,11 @@ export class PortingPortabilityContextImpl if (params["targetAccountSid"] !== undefined) data["TargetAccountSid"] = params["targetAccountSid"]; + if (params["addressSid"] !== undefined) + data["AddressSid"] = params["addressSid"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/numbers/v1/portingWebhookConfiguration.ts b/src/rest/numbers/v1/portingWebhookConfiguration.ts index e28dfb3e7b..d61d17fd87 100644 --- a/src/rest/numbers/v1/portingWebhookConfiguration.ts +++ b/src/rest/numbers/v1/portingWebhookConfiguration.ts @@ -50,12 +50,14 @@ export interface PortingWebhookConfigurationListInstance { * Create a PortingWebhookConfigurationInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingWebhookConfigurationInstance */ create( params: object, + headers?: any, callback?: ( error: Error | null, item?: PortingWebhookConfigurationInstance @@ -85,6 +87,7 @@ export function PortingWebhookConfigurationListInstance( error: Error | null, items: PortingWebhookConfigurationInstance ) => any), + headers?: any, callback?: ( error: Error | null, items: PortingWebhookConfigurationInstance @@ -101,8 +104,12 @@ export function PortingWebhookConfigurationListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/v1/portingWebhookConfigurationDelete.ts b/src/rest/numbers/v1/portingWebhookConfigurationDelete.ts index 8d0181c962..abeee9ffaf 100644 --- a/src/rest/numbers/v1/portingWebhookConfigurationDelete.ts +++ b/src/rest/numbers/v1/portingWebhookConfigurationDelete.ts @@ -66,11 +66,14 @@ export class PortingWebhookConfigurationDeleteContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( diff --git a/src/rest/numbers/v1/signingRequestConfiguration.ts b/src/rest/numbers/v1/signingRequestConfiguration.ts index e39126473a..8398269ae5 100644 --- a/src/rest/numbers/v1/signingRequestConfiguration.ts +++ b/src/rest/numbers/v1/signingRequestConfiguration.ts @@ -102,12 +102,14 @@ export interface SigningRequestConfigurationListInstance { * Create a SigningRequestConfigurationInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningRequestConfigurationInstance */ create( params: object, + headers?: any, callback?: ( error: Error | null, item?: SigningRequestConfigurationInstance @@ -227,6 +229,7 @@ export function SigningRequestConfigurationListInstance( error: Error | null, items: SigningRequestConfigurationInstance ) => any), + headers?: any, callback?: ( error: Error | null, items: SigningRequestConfigurationInstance @@ -243,8 +246,12 @@ export function SigningRequestConfigurationListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -292,6 +299,7 @@ export function SigningRequestConfigurationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v1/portingWebhookConfigurationFetch.ts b/src/rest/numbers/v1/webhook.ts similarity index 74% rename from src/rest/numbers/v1/portingWebhookConfigurationFetch.ts rename to src/rest/numbers/v1/webhook.ts index 65a19d1c06..f48c9294e3 100644 --- a/src/rest/numbers/v1/portingWebhookConfigurationFetch.ts +++ b/src/rest/numbers/v1/webhook.ts @@ -18,26 +18,23 @@ const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; -export interface PortingWebhookConfigurationFetchSolution {} +export interface WebhookSolution {} -export interface PortingWebhookConfigurationFetchListInstance { +export interface WebhookListInstance { _version: V1; - _solution: PortingWebhookConfigurationFetchSolution; + _solution: WebhookSolution; _uri: string; /** - * Fetch a PortingWebhookConfigurationFetchInstance + * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * - * @returns Resolves to processed PortingWebhookConfigurationFetchInstance + * @returns Resolves to processed WebhookInstance */ fetch( - callback?: ( - error: Error | null, - item?: PortingWebhookConfigurationFetchInstance - ) => any - ): Promise; + callback?: (error: Error | null, item?: WebhookInstance) => any + ): Promise; /** * Provide a user-friendly representation @@ -46,30 +43,28 @@ export interface PortingWebhookConfigurationFetchListInstance { [inspect.custom](_depth: any, options: InspectOptions): any; } -export function PortingWebhookConfigurationFetchListInstance( - version: V1 -): PortingWebhookConfigurationFetchListInstance { - const instance = {} as PortingWebhookConfigurationFetchListInstance; +export function WebhookListInstance(version: V1): WebhookListInstance { + const instance = {} as WebhookListInstance; instance._version = version; instance._solution = {}; instance._uri = `/Porting/Configuration/Webhook`; instance.fetch = function fetch( - callback?: ( - error: Error | null, - items: PortingWebhookConfigurationFetchInstance - ) => any - ): Promise { + callback?: (error: Error | null, items: WebhookInstance) => any + ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", + headers, }); operationPromise = operationPromise.then( - (payload) => - new PortingWebhookConfigurationFetchInstance(operationVersion, payload) + (payload) => new WebhookInstance(operationVersion, payload) ); operationPromise = instance._version.setPromiseCallback( @@ -93,10 +88,9 @@ export function PortingWebhookConfigurationFetchListInstance( return instance; } -interface PortingWebhookConfigurationFetchPayload - extends PortingWebhookConfigurationFetchResource {} +interface WebhookPayload extends WebhookResource {} -interface PortingWebhookConfigurationFetchResource { +interface WebhookResource { url: string; port_in_target_url: string; port_out_target_url: string; @@ -105,11 +99,8 @@ interface PortingWebhookConfigurationFetchResource { port_out_target_date_created: Date; } -export class PortingWebhookConfigurationFetchInstance { - constructor( - protected _version: V1, - payload: PortingWebhookConfigurationFetchResource - ) { +export class WebhookInstance { + constructor(protected _version: V1, payload: WebhookResource) { this.url = payload.url; this.portInTargetUrl = payload.port_in_target_url; this.portOutTargetUrl = payload.port_out_target_url; diff --git a/src/rest/numbers/v2/authorizationDocument.ts b/src/rest/numbers/v2/authorizationDocument.ts index 27692bbea3..a2d445ffce 100644 --- a/src/rest/numbers/v2/authorizationDocument.ts +++ b/src/rest/numbers/v2/authorizationDocument.ts @@ -162,11 +162,14 @@ export class AuthorizationDocumentContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -182,11 +185,15 @@ export class AuthorizationDocumentContextImpl item?: AuthorizationDocumentInstance ) => any ): Promise { + 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( @@ -536,6 +543,7 @@ export function AuthorizationDocumentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -579,6 +587,7 @@ export function AuthorizationDocumentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.ts b/src/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.ts index 22c8228136..795c54ddd2 100644 --- a/src/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.ts +++ b/src/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.ts @@ -244,6 +244,7 @@ export function DependentHostedNumberOrderListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/bulkHostedNumberOrder.ts b/src/rest/numbers/v2/bulkHostedNumberOrder.ts index 480070f1b2..77187ef0fa 100644 --- a/src/rest/numbers/v2/bulkHostedNumberOrder.ts +++ b/src/rest/numbers/v2/bulkHostedNumberOrder.ts @@ -117,6 +117,7 @@ export class BulkHostedNumberOrderContextImpl data["OrderStatus"] = params["orderStatus"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -327,12 +328,14 @@ export interface BulkHostedNumberOrderListInstance { * Create a BulkHostedNumberOrderInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ create( params: object, + headers?: any, callback?: ( error: Error | null, item?: BulkHostedNumberOrderInstance @@ -364,6 +367,7 @@ export function BulkHostedNumberOrderListInstance( params?: | object | ((error: Error | null, items: BulkHostedNumberOrderInstance) => any), + headers?: any, callback?: ( error: Error | null, items: BulkHostedNumberOrderInstance @@ -380,8 +384,12 @@ export function BulkHostedNumberOrderListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/v2/bundleClone.ts b/src/rest/numbers/v2/bundleClone.ts index 85509b98d1..93ea94b519 100644 --- a/src/rest/numbers/v2/bundleClone.ts +++ b/src/rest/numbers/v2/bundleClone.ts @@ -103,6 +103,7 @@ export class BundleCloneContextImpl implements BundleCloneContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/numbers/v2/hostedNumberOrder.ts b/src/rest/numbers/v2/hostedNumberOrder.ts index 3f9e19a457..cf4ef750ce 100644 --- a/src/rest/numbers/v2/hostedNumberOrder.ts +++ b/src/rest/numbers/v2/hostedNumberOrder.ts @@ -23,6 +23,7 @@ import { PhoneNumberCapabilities } from "../../../interfaces"; export type HostedNumberOrderStatus = | "received" + | "pending-verification" | "verified" | "pending-loa" | "carrier-processing" @@ -30,6 +31,20 @@ export type HostedNumberOrderStatus = | "failed" | "action-required"; +export type HostedNumberOrderVerificationType = "phone-call"; + +/** + * Options to pass to update a HostedNumberOrderInstance + */ +export interface HostedNumberOrderContextUpdateOptions { + /** */ + status: HostedNumberOrderStatus; + /** The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. */ + verificationCallDelay?: number; + /** The numerical extension to dial when making the ownership verification call. */ + verificationCallExtension?: string; +} + /** * Options to pass to create a HostedNumberOrderInstance */ @@ -159,6 +174,19 @@ export interface HostedNumberOrderContext { callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any ): Promise; + /** + * Update a HostedNumberOrderInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed HostedNumberOrderInstance + */ + update( + params: HostedNumberOrderContextUpdateOptions, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise; + /** * Provide a user-friendly representation */ @@ -186,11 +214,14 @@ export class HostedNumberOrderContextImpl implements HostedNumberOrderContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -203,11 +234,64 @@ export class HostedNumberOrderContextImpl implements HostedNumberOrderContext { fetch( callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any ): Promise { + 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( + (payload) => + new HostedNumberOrderInstance( + operationVersion, + payload, + instance._solution.sid + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + update( + params: HostedNumberOrderContextUpdateOptions, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["status"] === null || params["status"] === undefined) { + throw new Error("Required parameter \"params['status']\" missing."); + } + + let data: any = {}; + + data["Status"] = params["status"]; + if (params["verificationCallDelay"] !== undefined) + data["VerificationCallDelay"] = params["verificationCallDelay"]; + if (params["verificationCallExtension"] !== undefined) + data["VerificationCallExtension"] = params["verificationCallExtension"]; + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.update({ + uri: instance._uri, + method: "post", + data, + headers, }); operationPromise = operationPromise.then( @@ -264,6 +348,12 @@ interface HostedNumberOrderResource { contact_phone_number: string; bulk_hosting_request_sid: string; next_step: string; + verification_attempts: number; + verification_call_sids: Array; + verification_call_delay: number; + verification_call_extension: string; + verification_code: string; + verification_type: HostedNumberOrderVerificationType; } export class HostedNumberOrderInstance { @@ -294,6 +384,16 @@ export class HostedNumberOrderInstance { this.contactPhoneNumber = payload.contact_phone_number; this.bulkHostingRequestSid = payload.bulk_hosting_request_sid; this.nextStep = payload.next_step; + this.verificationAttempts = deserialize.integer( + payload.verification_attempts + ); + this.verificationCallSids = payload.verification_call_sids; + this.verificationCallDelay = deserialize.integer( + payload.verification_call_delay + ); + this.verificationCallExtension = payload.verification_call_extension; + this.verificationCode = payload.verification_code; + this.verificationType = payload.verification_type; this._solution = { sid: sid || this.sid }; } @@ -368,6 +468,27 @@ export class HostedNumberOrderInstance { * The next step you need to take to complete the hosted number order and request it successfully. */ nextStep: string; + /** + * The number of attempts made to verify ownership via a call for the hosted phone number. + */ + verificationAttempts: number; + /** + * The Call SIDs that identify the calls placed to verify ownership. + */ + verificationCallSids: Array; + /** + * The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + */ + verificationCallDelay: number; + /** + * The numerical extension to dial when making the ownership verification call. + */ + verificationCallExtension: string; + /** + * The digits the user must pass in the ownership verification call. + */ + verificationCode: string; + verificationType: HostedNumberOrderVerificationType; private get _proxy(): HostedNumberOrderContext { this._context = @@ -402,6 +523,26 @@ export class HostedNumberOrderInstance { return this._proxy.fetch(callback); } + /** + * Update a HostedNumberOrderInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed HostedNumberOrderInstance + */ + update( + params: HostedNumberOrderContextUpdateOptions, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise; + + update( + params?: any, + callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any + ): Promise { + return this._proxy.update(params, callback); + } + /** * Provide a user-friendly representation * @@ -428,6 +569,12 @@ export class HostedNumberOrderInstance { contactPhoneNumber: this.contactPhoneNumber, bulkHostingRequestSid: this.bulkHostingRequestSid, nextStep: this.nextStep, + verificationAttempts: this.verificationAttempts, + verificationCallSids: this.verificationCallSids, + verificationCallDelay: this.verificationCallDelay, + verificationCallExtension: this.verificationCallExtension, + verificationCode: this.verificationCode, + verificationType: this.verificationType, }; } @@ -619,6 +766,7 @@ export function HostedNumberOrderListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -669,6 +817,7 @@ export function HostedNumberOrderListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/bundle.ts b/src/rest/numbers/v2/regulatoryCompliance/bundle.ts index 39f118e9d0..9c7e8f3e91 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/bundle.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/bundle.ts @@ -286,11 +286,14 @@ export class BundleContextImpl implements BundleContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -303,11 +306,15 @@ export class BundleContextImpl implements BundleContext { fetch( callback?: (error: Error | null, item?: BundleInstance) => any ): Promise { + 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( @@ -346,6 +353,7 @@ export class BundleContextImpl implements BundleContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -734,6 +742,7 @@ export function BundleListInstance(version: V2): BundleListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -801,6 +810,7 @@ export function BundleListInstance(version: V2): BundleListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/bundle/bundleCopy.ts b/src/rest/numbers/v2/regulatoryCompliance/bundle/bundleCopy.ts index d315ae9a02..c8b7637af7 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/bundle/bundleCopy.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/bundle/bundleCopy.ts @@ -213,6 +213,7 @@ export function BundleCopyListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -259,6 +260,7 @@ export function BundleCopyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.ts b/src/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.ts index 1d2b280539..eed6d03e2f 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.ts @@ -102,11 +102,15 @@ export class EvaluationContextImpl implements EvaluationContext { fetch( callback?: (error: Error | null, item?: EvaluationInstance) => any ): Promise { + 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( @@ -368,10 +372,14 @@ export function EvaluationListInstance( instance.create = function create( callback?: (error: Error | null, items: EvaluationInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", + headers, }); operationPromise = operationPromise.then( @@ -411,6 +419,7 @@ export function EvaluationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.ts b/src/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.ts index 435c46a6ee..6593d72077 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.ts @@ -121,11 +121,14 @@ export class ItemAssignmentContextImpl implements ItemAssignmentContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -138,11 +141,15 @@ export class ItemAssignmentContextImpl implements ItemAssignmentContext { fetch( callback?: (error: Error | null, item?: ItemAssignmentInstance) => any ): Promise { + 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( @@ -435,6 +442,7 @@ export function ItemAssignmentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -481,6 +489,7 @@ export function ItemAssignmentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/bundle/replaceItems.ts b/src/rest/numbers/v2/regulatoryCompliance/bundle/replaceItems.ts index e605940f32..008da52cb7 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/bundle/replaceItems.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/bundle/replaceItems.ts @@ -100,6 +100,7 @@ export function ReplaceItemsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/endUser.ts b/src/rest/numbers/v2/regulatoryCompliance/endUser.ts index bc9e48d9fa..668c344c36 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/endUser.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/endUser.ts @@ -152,11 +152,14 @@ export class EndUserContextImpl implements EndUserContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -169,11 +172,15 @@ export class EndUserContextImpl implements EndUserContext { fetch( callback?: (error: Error | null, item?: EndUserInstance) => any ): Promise { + 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( @@ -210,6 +217,7 @@ export class EndUserContextImpl implements EndUserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -533,6 +541,7 @@ export function EndUserListInstance(version: V2): EndUserListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -574,6 +583,7 @@ export function EndUserListInstance(version: V2): EndUserListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/endUserType.ts b/src/rest/numbers/v2/regulatoryCompliance/endUserType.ts index e24031d073..036272d235 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/endUserType.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/endUserType.ts @@ -95,11 +95,15 @@ export class EndUserTypeContextImpl implements EndUserTypeContext { fetch( callback?: (error: Error | null, item?: EndUserTypeInstance) => any ): Promise { + 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( @@ -341,6 +345,7 @@ export function EndUserTypeListInstance(version: V2): EndUserTypeListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/regulation.ts b/src/rest/numbers/v2/regulatoryCompliance/regulation.ts index 655f950910..0be116318c 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/regulation.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/regulation.ts @@ -156,6 +156,7 @@ export class RegulationContextImpl implements RegulationContext { data["IncludeConstraints"] = serialize.bool(params["includeConstraints"]); const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -441,6 +442,7 @@ export function RegulationListInstance(version: V2): RegulationListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/supportingDocument.ts b/src/rest/numbers/v2/regulatoryCompliance/supportingDocument.ts index 34aa7c3a4d..e55dc474f2 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/supportingDocument.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/supportingDocument.ts @@ -163,11 +163,14 @@ export class SupportingDocumentContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -180,11 +183,15 @@ export class SupportingDocumentContextImpl fetch( callback?: (error: Error | null, item?: SupportingDocumentInstance) => any ): Promise { + 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( @@ -225,6 +232,7 @@ export class SupportingDocumentContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -593,6 +601,7 @@ export function SupportingDocumentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -634,6 +643,7 @@ export function SupportingDocumentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.ts b/src/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.ts index 02ed9c8855..2f53780669 100644 --- a/src/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.ts +++ b/src/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.ts @@ -106,11 +106,15 @@ export class SupportingDocumentTypeContextImpl item?: SupportingDocumentTypeInstance ) => any ): Promise { + 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( @@ -370,6 +374,7 @@ export function SupportingDocumentTypeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/oauth/v1/authorize.ts b/src/rest/oauth/v1/authorize.ts index 651e95b6b3..9e0f57547d 100644 --- a/src/rest/oauth/v1/authorize.ts +++ b/src/rest/oauth/v1/authorize.ts @@ -102,6 +102,7 @@ export function AuthorizeListInstance(version: V1): AuthorizeListInstance { if (params["state"] !== undefined) data["State"] = params["state"]; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.fetch({ diff --git a/src/rest/oauth/v1/token.ts b/src/rest/oauth/v1/token.ts index cfaf8d5359..bec6b01436 100644 --- a/src/rest/oauth/v1/token.ts +++ b/src/rest/oauth/v1/token.ts @@ -107,6 +107,7 @@ export function TokenListInstance(version: V1): TokenListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/preview/DeployedDevices.ts b/src/rest/preview/DeployedDevices.ts deleted file mode 100644 index e400afccbf..0000000000 --- a/src/rest/preview/DeployedDevices.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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 PreviewBase from "../PreviewBase"; -import Version from "../../base/Version"; -import { FleetListInstance } from "./deployed_devices/fleet"; - -export default class DeployedDevices extends Version { - /** - * Initialize the DeployedDevices version of Preview - * - * @param domain - The Twilio (Twilio.Preview) domain - */ - constructor(domain: PreviewBase) { - super(domain, "DeployedDevices"); - } - - /** fleets - { Twilio.Preview.DeployedDevices.FleetListInstance } resource */ - protected _fleets?: FleetListInstance; - - /** Getter for fleets resource */ - get fleets(): FleetListInstance { - this._fleets = this._fleets || FleetListInstance(this); - return this._fleets; - } -} diff --git a/src/rest/preview/deployed_devices/fleet.ts b/src/rest/preview/deployed_devices/fleet.ts deleted file mode 100644 index 1a63121ae7..0000000000 --- a/src/rest/preview/deployed_devices/fleet.ts +++ /dev/null @@ -1,738 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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 Page, { TwilioResponsePayload } from "../../../base/Page"; -import Response from "../../../http/response"; -import DeployedDevices from "../DeployedDevices"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; -import { CertificateListInstance } from "./fleet/certificate"; -import { DeploymentListInstance } from "./fleet/deployment"; -import { DeviceListInstance } from "./fleet/device"; -import { KeyListInstance } from "./fleet/key"; - -/** - * Options to pass to update a FleetInstance - */ -export interface FleetContextUpdateOptions { - /** Provides a human readable descriptive text for this Fleet, up to 256 characters long. */ - friendlyName?: string; - /** Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. */ - defaultDeploymentSid?: string; -} - -/** - * Options to pass to create a FleetInstance - */ -export interface FleetListInstanceCreateOptions { - /** Provides a human readable descriptive text for this Fleet, up to 256 characters long. */ - friendlyName?: string; -} -/** - * Options to pass to each - */ -export interface FleetListInstanceEachOptions { - /** 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 */ - callback?: (item: FleetInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface FleetListInstanceOptions { - /** 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 */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface FleetListInstancePageOptions { - /** 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 */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface FleetContext { - certificates: CertificateListInstance; - deployments: DeploymentListInstance; - devices: DeviceListInstance; - keys: KeyListInstance; - - /** - * Remove a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - fetch( - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - - /** - * Update a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - update( - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - /** - * Update a FleetInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - update( - params: FleetContextUpdateOptions, - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface FleetContextSolution { - sid: string; -} - -export class FleetContextImpl implements FleetContext { - protected _solution: FleetContextSolution; - protected _uri: string; - - protected _certificates?: CertificateListInstance; - protected _deployments?: DeploymentListInstance; - protected _devices?: DeviceListInstance; - protected _keys?: KeyListInstance; - - constructor(protected _version: DeployedDevices, sid: string) { - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { sid }; - this._uri = `/Fleets/${sid}`; - } - - get certificates(): CertificateListInstance { - this._certificates = - this._certificates || - CertificateListInstance(this._version, this._solution.sid); - return this._certificates; - } - - get deployments(): DeploymentListInstance { - this._deployments = - this._deployments || - DeploymentListInstance(this._version, this._solution.sid); - return this._deployments; - } - - get devices(): DeviceListInstance { - this._devices = - this._devices || DeviceListInstance(this._version, this._solution.sid); - return this._devices; - } - - get keys(): KeyListInstance { - this._keys = - this._keys || KeyListInstance(this._version, this._solution.sid); - return this._keys; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new FleetInstance(operationVersion, payload, instance._solution.sid) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | FleetContextUpdateOptions - | ((error: Error | null, item?: FleetInstance) => any), - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["defaultDeploymentSid"] !== undefined) - data["DefaultDeploymentSid"] = params["defaultDeploymentSid"]; - - 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 FleetInstance(operationVersion, payload, instance._solution.sid) - ); - - 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 FleetPayload extends TwilioResponsePayload { - fleets: FleetResource[]; -} - -interface FleetResource { - sid: string; - url: string; - unique_name: string; - friendly_name: string; - account_sid: string; - default_deployment_sid: string; - date_created: Date; - date_updated: Date; - links: Record; -} - -export class FleetInstance { - protected _solution: FleetContextSolution; - protected _context?: FleetContext; - - constructor( - protected _version: DeployedDevices, - payload: FleetResource, - sid?: string - ) { - this.sid = payload.sid; - this.url = payload.url; - this.uniqueName = payload.unique_name; - this.friendlyName = payload.friendly_name; - this.accountSid = payload.account_sid; - this.defaultDeploymentSid = payload.default_deployment_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.links = payload.links; - - this._solution = { sid: sid || this.sid }; - } - - /** - * Contains a 34 character string that uniquely identifies this Fleet resource. - */ - sid: string; - /** - * Contains an absolute URL for this Fleet resource. - */ - url: string; - /** - * Contains a unique and addressable name of this Fleet, e.g. \'default\', up to 128 characters long. - */ - uniqueName: string; - /** - * Contains a human readable descriptive text for this Fleet, up to 256 characters long. - */ - friendlyName: string; - /** - * Speicifies the unique string identifier of the Account responsible for this Fleet. - */ - accountSid: string; - /** - * Contains the string identifier of the automatically provisioned default Deployment of this Fleet. - */ - defaultDeploymentSid: string; - /** - * Specifies the date this Fleet was created, given in UTC ISO 8601 format. - */ - dateCreated: Date; - /** - * Specifies the date this Fleet was last updated, given in UTC ISO 8601 format. - */ - dateUpdated: Date; - /** - * Contains a dictionary of URL links to nested resources of this Fleet. - */ - links: Record; - - private get _proxy(): FleetContext { - this._context = - this._context || new FleetContextImpl(this._version, this._solution.sid); - return this._context; - } - - /** - * Remove a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - fetch( - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - update( - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - /** - * Update a FleetInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - update( - params: FleetContextUpdateOptions, - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Access the certificates. - */ - certificates(): CertificateListInstance { - return this._proxy.certificates; - } - - /** - * Access the deployments. - */ - deployments(): DeploymentListInstance { - return this._proxy.deployments; - } - - /** - * Access the devices. - */ - devices(): DeviceListInstance { - return this._proxy.devices; - } - - /** - * Access the keys. - */ - keys(): KeyListInstance { - return this._proxy.keys; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - sid: this.sid, - url: this.url, - uniqueName: this.uniqueName, - friendlyName: this.friendlyName, - accountSid: this.accountSid, - defaultDeploymentSid: this.defaultDeploymentSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - links: this.links, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface FleetSolution {} - -export interface FleetListInstance { - _version: DeployedDevices; - _solution: FleetSolution; - _uri: string; - - (sid: string): FleetContext; - get(sid: string): FleetContext; - - /** - * Create a FleetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - create( - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - /** - * Create a FleetInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FleetInstance - */ - create( - params: FleetListInstanceCreateOptions, - callback?: (error: Error | null, item?: FleetInstance) => any - ): Promise; - - /** - * Streams FleetInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FleetListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: FleetInstance, done: (err?: Error) => void) => void - ): void; - each( - params: FleetListInstanceEachOptions, - callback?: (item: FleetInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of FleetInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: FleetPage) => any - ): Promise; - /** - * Lists FleetInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FleetListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: FleetInstance[]) => any - ): Promise; - list( - params: FleetListInstanceOptions, - callback?: (error: Error | null, items: FleetInstance[]) => any - ): Promise; - /** - * Retrieve a single page of FleetInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FleetListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: FleetPage) => any - ): Promise; - page( - params: FleetListInstancePageOptions, - callback?: (error: Error | null, items: FleetPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function FleetListInstance(version: DeployedDevices): FleetListInstance { - const instance = ((sid) => instance.get(sid)) as FleetListInstance; - - instance.get = function get(sid): FleetContext { - return new FleetContextImpl(version, sid); - }; - - instance._version = version; - instance._solution = {}; - instance._uri = `/Fleets`; - - instance.create = function create( - params?: - | FleetListInstanceCreateOptions - | ((error: Error | null, items: FleetInstance) => any), - callback?: (error: Error | null, items: FleetInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - - 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 FleetInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | FleetListInstancePageOptions - | ((error: Error | null, items: FleetPage) => any), - callback?: (error: Error | null, items: FleetPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new FleetPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: FleetPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => new FleetPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class FleetPage extends Page< - DeployedDevices, - FleetPayload, - FleetResource, - FleetInstance -> { - /** - * Initialize the FleetPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: DeployedDevices, - response: Response, - solution: FleetSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of FleetInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: FleetResource): FleetInstance { - return new FleetInstance(this._version, payload); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/preview/deployed_devices/fleet/certificate.ts b/src/rest/preview/deployed_devices/fleet/certificate.ts deleted file mode 100644 index 788abbc0a7..0000000000 --- a/src/rest/preview/deployed_devices/fleet/certificate.ts +++ /dev/null @@ -1,724 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import DeployedDevices from "../../DeployedDevices"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -/** - * Options to pass to update a CertificateInstance - */ -export interface CertificateContextUpdateOptions { - /** Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. */ - friendlyName?: string; - /** Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. */ - deviceSid?: string; -} - -/** - * Options to pass to create a CertificateInstance - */ -export interface CertificateListInstanceCreateOptions { - /** Provides a URL encoded representation of the public certificate in PEM format. */ - certificateData: string; - /** Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. */ - friendlyName?: string; - /** Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. */ - deviceSid?: string; -} -/** - * Options to pass to each - */ -export interface CertificateListInstanceEachOptions { - /** Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. */ - deviceSid?: string; - /** 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 */ - callback?: (item: CertificateInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface CertificateListInstanceOptions { - /** Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. */ - deviceSid?: string; - /** 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 */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface CertificateListInstancePageOptions { - /** Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. */ - deviceSid?: string; - /** 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 */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface CertificateContext { - /** - * Remove a CertificateInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a CertificateInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - fetch( - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise; - - /** - * Update a CertificateInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - update( - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise; - /** - * Update a CertificateInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - update( - params: CertificateContextUpdateOptions, - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface CertificateContextSolution { - fleetSid: string; - sid: string; -} - -export class CertificateContextImpl implements CertificateContext { - protected _solution: CertificateContextSolution; - protected _uri: string; - - constructor( - protected _version: DeployedDevices, - fleetSid: string, - sid: string - ) { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { fleetSid, sid }; - this._uri = `/Fleets/${fleetSid}/Certificates/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new CertificateInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | CertificateContextUpdateOptions - | ((error: Error | null, item?: CertificateInstance) => any), - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["deviceSid"] !== undefined) - data["DeviceSid"] = params["deviceSid"]; - - 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 CertificateInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - 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 CertificatePayload extends TwilioResponsePayload { - certificates: CertificateResource[]; -} - -interface CertificateResource { - sid: string; - url: string; - friendly_name: string; - fleet_sid: string; - account_sid: string; - device_sid: string; - thumbprint: string; - date_created: Date; - date_updated: Date; -} - -export class CertificateInstance { - protected _solution: CertificateContextSolution; - protected _context?: CertificateContext; - - constructor( - protected _version: DeployedDevices, - payload: CertificateResource, - fleetSid: string, - sid?: string - ) { - this.sid = payload.sid; - this.url = payload.url; - this.friendlyName = payload.friendly_name; - this.fleetSid = payload.fleet_sid; - this.accountSid = payload.account_sid; - this.deviceSid = payload.device_sid; - this.thumbprint = payload.thumbprint; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - - this._solution = { fleetSid, sid: sid || this.sid }; - } - - /** - * Contains a 34 character string that uniquely identifies this Certificate credential resource. - */ - sid: string; - /** - * Contains an absolute URL for this Certificate credential resource. - */ - url: string; - /** - * Contains a human readable descriptive text for this Certificate credential, up to 256 characters long. - */ - friendlyName: string; - /** - * Specifies the unique string identifier of the Fleet that the given Certificate credential belongs to. - */ - fleetSid: string; - /** - * Specifies the unique string identifier of the Account responsible for this Certificate credential. - */ - accountSid: string; - /** - * Specifies the unique string identifier of a Device authenticated with this Certificate credential. - */ - deviceSid: string; - /** - * Contains a unique hash of the payload of this Certificate credential, used to authenticate the Device. - */ - thumbprint: string; - /** - * Specifies the date this Certificate credential was created, given in UTC ISO 8601 format. - */ - dateCreated: Date; - /** - * Specifies the date this Certificate credential was last updated, given in UTC ISO 8601 format. - */ - dateUpdated: Date; - - private get _proxy(): CertificateContext { - this._context = - this._context || - new CertificateContextImpl( - this._version, - this._solution.fleetSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a CertificateInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a CertificateInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - fetch( - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a CertificateInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - update( - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise; - /** - * Update a CertificateInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - update( - params: CertificateContextUpdateOptions, - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - sid: this.sid, - url: this.url, - friendlyName: this.friendlyName, - fleetSid: this.fleetSid, - accountSid: this.accountSid, - deviceSid: this.deviceSid, - thumbprint: this.thumbprint, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface CertificateSolution { - fleetSid: string; -} - -export interface CertificateListInstance { - _version: DeployedDevices; - _solution: CertificateSolution; - _uri: string; - - (sid: string): CertificateContext; - get(sid: string): CertificateContext; - - /** - * Create a CertificateInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed CertificateInstance - */ - create( - params: CertificateListInstanceCreateOptions, - callback?: (error: Error | null, item?: CertificateInstance) => any - ): Promise; - - /** - * Streams CertificateInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { CertificateListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: CertificateInstance, done: (err?: Error) => void) => void - ): void; - each( - params: CertificateListInstanceEachOptions, - callback?: (item: CertificateInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of CertificateInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: CertificatePage) => any - ): Promise; - /** - * Lists CertificateInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { CertificateListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: CertificateInstance[]) => any - ): Promise; - list( - params: CertificateListInstanceOptions, - callback?: (error: Error | null, items: CertificateInstance[]) => any - ): Promise; - /** - * Retrieve a single page of CertificateInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { CertificateListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: CertificatePage) => any - ): Promise; - page( - params: CertificateListInstancePageOptions, - callback?: (error: Error | null, items: CertificatePage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function CertificateListInstance( - version: DeployedDevices, - fleetSid: string -): CertificateListInstance { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as CertificateListInstance; - - instance.get = function get(sid): CertificateContext { - return new CertificateContextImpl(version, fleetSid, sid); - }; - - instance._version = version; - instance._solution = { fleetSid }; - instance._uri = `/Fleets/${fleetSid}/Certificates`; - - instance.create = function create( - params: CertificateListInstanceCreateOptions, - callback?: (error: Error | null, items: CertificateInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if ( - params["certificateData"] === null || - params["certificateData"] === undefined - ) { - throw new Error( - "Required parameter \"params['certificateData']\" missing." - ); - } - - let data: any = {}; - - data["CertificateData"] = params["certificateData"]; - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["deviceSid"] !== undefined) - data["DeviceSid"] = params["deviceSid"]; - - 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 CertificateInstance( - operationVersion, - payload, - instance._solution.fleetSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | CertificateListInstancePageOptions - | ((error: Error | null, items: CertificatePage) => any), - callback?: (error: Error | null, items: CertificatePage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["deviceSid"] !== undefined) - data["DeviceSid"] = params["deviceSid"]; - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new CertificatePage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: CertificatePage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new CertificatePage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class CertificatePage extends Page< - DeployedDevices, - CertificatePayload, - CertificateResource, - CertificateInstance -> { - /** - * Initialize the CertificatePage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: DeployedDevices, - response: Response, - solution: CertificateSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of CertificateInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: CertificateResource): CertificateInstance { - return new CertificateInstance( - this._version, - payload, - this._solution.fleetSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/preview/deployed_devices/fleet/deployment.ts b/src/rest/preview/deployed_devices/fleet/deployment.ts deleted file mode 100644 index 21c07750bc..0000000000 --- a/src/rest/preview/deployed_devices/fleet/deployment.ts +++ /dev/null @@ -1,712 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import DeployedDevices from "../../DeployedDevices"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -/** - * Options to pass to update a DeploymentInstance - */ -export interface DeploymentContextUpdateOptions { - /** Provides a human readable descriptive text for this Deployment, up to 64 characters long */ - friendlyName?: string; - /** Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. */ - syncServiceSid?: string; -} - -/** - * Options to pass to create a DeploymentInstance - */ -export interface DeploymentListInstanceCreateOptions { - /** Provides a human readable descriptive text for this Deployment, up to 256 characters long. */ - friendlyName?: string; - /** Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. */ - syncServiceSid?: string; -} -/** - * Options to pass to each - */ -export interface DeploymentListInstanceEachOptions { - /** 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 */ - callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface DeploymentListInstanceOptions { - /** 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 */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface DeploymentListInstancePageOptions { - /** 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 */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface DeploymentContext { - /** - * Remove a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - fetch( - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - - /** - * Update a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - update( - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - /** - * Update a DeploymentInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - update( - params: DeploymentContextUpdateOptions, - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface DeploymentContextSolution { - fleetSid: string; - sid: string; -} - -export class DeploymentContextImpl implements DeploymentContext { - protected _solution: DeploymentContextSolution; - protected _uri: string; - - constructor( - protected _version: DeployedDevices, - fleetSid: string, - sid: string - ) { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { fleetSid, sid }; - this._uri = `/Fleets/${fleetSid}/Deployments/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new DeploymentInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | DeploymentContextUpdateOptions - | ((error: Error | null, item?: DeploymentInstance) => any), - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["syncServiceSid"] !== undefined) - data["SyncServiceSid"] = params["syncServiceSid"]; - - 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 DeploymentInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - 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 DeploymentPayload extends TwilioResponsePayload { - deployments: DeploymentResource[]; -} - -interface DeploymentResource { - sid: string; - url: string; - friendly_name: string; - fleet_sid: string; - account_sid: string; - sync_service_sid: string; - date_created: Date; - date_updated: Date; -} - -export class DeploymentInstance { - protected _solution: DeploymentContextSolution; - protected _context?: DeploymentContext; - - constructor( - protected _version: DeployedDevices, - payload: DeploymentResource, - fleetSid: string, - sid?: string - ) { - this.sid = payload.sid; - this.url = payload.url; - this.friendlyName = payload.friendly_name; - this.fleetSid = payload.fleet_sid; - this.accountSid = payload.account_sid; - this.syncServiceSid = payload.sync_service_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - - this._solution = { fleetSid, sid: sid || this.sid }; - } - - /** - * Contains a 34 character string that uniquely identifies this Deployment resource. - */ - sid: string; - /** - * Contains an absolute URL for this Deployment resource. - */ - url: string; - /** - * Contains a human readable descriptive text for this Deployment, up to 64 characters long - */ - friendlyName: string; - /** - * Specifies the unique string identifier of the Fleet that the given Deployment belongs to. - */ - fleetSid: string; - /** - * Specifies the unique string identifier of the Account responsible for this Deployment. - */ - accountSid: string; - /** - * Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment. - */ - syncServiceSid: string; - /** - * Specifies the date this Deployment was created, given in UTC ISO 8601 format. - */ - dateCreated: Date; - /** - * Specifies the date this Deployment was last updated, given in UTC ISO 8601 format. - */ - dateUpdated: Date; - - private get _proxy(): DeploymentContext { - this._context = - this._context || - new DeploymentContextImpl( - this._version, - this._solution.fleetSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - fetch( - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - update( - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - /** - * Update a DeploymentInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - update( - params: DeploymentContextUpdateOptions, - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - sid: this.sid, - url: this.url, - friendlyName: this.friendlyName, - fleetSid: this.fleetSid, - accountSid: this.accountSid, - syncServiceSid: this.syncServiceSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface DeploymentSolution { - fleetSid: string; -} - -export interface DeploymentListInstance { - _version: DeployedDevices; - _solution: DeploymentSolution; - _uri: string; - - (sid: string): DeploymentContext; - get(sid: string): DeploymentContext; - - /** - * Create a DeploymentInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - create( - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - /** - * Create a DeploymentInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeploymentInstance - */ - create( - params: DeploymentListInstanceCreateOptions, - callback?: (error: Error | null, item?: DeploymentInstance) => any - ): Promise; - - /** - * Streams DeploymentInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { DeploymentListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void - ): void; - each( - params: DeploymentListInstanceEachOptions, - callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of DeploymentInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: DeploymentPage) => any - ): Promise; - /** - * Lists DeploymentInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { DeploymentListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: DeploymentInstance[]) => any - ): Promise; - list( - params: DeploymentListInstanceOptions, - callback?: (error: Error | null, items: DeploymentInstance[]) => any - ): Promise; - /** - * Retrieve a single page of DeploymentInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { DeploymentListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: DeploymentPage) => any - ): Promise; - page( - params: DeploymentListInstancePageOptions, - callback?: (error: Error | null, items: DeploymentPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DeploymentListInstance( - version: DeployedDevices, - fleetSid: string -): DeploymentListInstance { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as DeploymentListInstance; - - instance.get = function get(sid): DeploymentContext { - return new DeploymentContextImpl(version, fleetSid, sid); - }; - - instance._version = version; - instance._solution = { fleetSid }; - instance._uri = `/Fleets/${fleetSid}/Deployments`; - - instance.create = function create( - params?: - | DeploymentListInstanceCreateOptions - | ((error: Error | null, items: DeploymentInstance) => any), - callback?: (error: Error | null, items: DeploymentInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["syncServiceSid"] !== undefined) - data["SyncServiceSid"] = params["syncServiceSid"]; - - 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 DeploymentInstance( - operationVersion, - payload, - instance._solution.fleetSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | DeploymentListInstancePageOptions - | ((error: Error | null, items: DeploymentPage) => any), - callback?: (error: Error | null, items: DeploymentPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new DeploymentPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: DeploymentPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new DeploymentPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class DeploymentPage extends Page< - DeployedDevices, - DeploymentPayload, - DeploymentResource, - DeploymentInstance -> { - /** - * Initialize the DeploymentPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: DeployedDevices, - response: Response, - solution: DeploymentSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of DeploymentInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: DeploymentResource): DeploymentInstance { - return new DeploymentInstance( - this._version, - payload, - this._solution.fleetSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/preview/deployed_devices/fleet/device.ts b/src/rest/preview/deployed_devices/fleet/device.ts deleted file mode 100644 index f6ad90ac4d..0000000000 --- a/src/rest/preview/deployed_devices/fleet/device.ts +++ /dev/null @@ -1,763 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import DeployedDevices from "../../DeployedDevices"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -/** - * Options to pass to update a DeviceInstance - */ -export interface DeviceContextUpdateOptions { - /** Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. */ - friendlyName?: string; - /** Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. */ - identity?: string; - /** Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. */ - deploymentSid?: string; - /** */ - enabled?: boolean; -} - -/** - * Options to pass to create a DeviceInstance - */ -export interface DeviceListInstanceCreateOptions { - /** Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long. */ - uniqueName?: string; - /** Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. */ - friendlyName?: string; - /** Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. */ - identity?: string; - /** Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. */ - deploymentSid?: string; - /** */ - enabled?: boolean; -} -/** - * Options to pass to each - */ -export interface DeviceListInstanceEachOptions { - /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */ - deploymentSid?: string; - /** 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 */ - callback?: (item: DeviceInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface DeviceListInstanceOptions { - /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */ - deploymentSid?: string; - /** 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 */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface DeviceListInstancePageOptions { - /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */ - deploymentSid?: string; - /** 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 */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface DeviceContext { - /** - * Remove a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - fetch( - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - - /** - * Update a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - update( - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - /** - * Update a DeviceInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - update( - params: DeviceContextUpdateOptions, - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface DeviceContextSolution { - fleetSid: string; - sid: string; -} - -export class DeviceContextImpl implements DeviceContext { - protected _solution: DeviceContextSolution; - protected _uri: string; - - constructor( - protected _version: DeployedDevices, - fleetSid: string, - sid: string - ) { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { fleetSid, sid }; - this._uri = `/Fleets/${fleetSid}/Devices/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new DeviceInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | DeviceContextUpdateOptions - | ((error: Error | null, item?: DeviceInstance) => any), - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["identity"] !== undefined) data["Identity"] = params["identity"]; - if (params["deploymentSid"] !== undefined) - data["DeploymentSid"] = params["deploymentSid"]; - if (params["enabled"] !== undefined) - data["Enabled"] = serialize.bool(params["enabled"]); - - 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 DeviceInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - 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 DevicePayload extends TwilioResponsePayload { - devices: DeviceResource[]; -} - -interface DeviceResource { - sid: string; - url: string; - unique_name: string; - friendly_name: string; - fleet_sid: string; - enabled: boolean; - account_sid: string; - identity: string; - deployment_sid: string; - date_created: Date; - date_updated: Date; - date_authenticated: Date; -} - -export class DeviceInstance { - protected _solution: DeviceContextSolution; - protected _context?: DeviceContext; - - constructor( - protected _version: DeployedDevices, - payload: DeviceResource, - fleetSid: string, - sid?: string - ) { - this.sid = payload.sid; - this.url = payload.url; - this.uniqueName = payload.unique_name; - this.friendlyName = payload.friendly_name; - this.fleetSid = payload.fleet_sid; - this.enabled = payload.enabled; - this.accountSid = payload.account_sid; - this.identity = payload.identity; - this.deploymentSid = payload.deployment_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.dateAuthenticated = deserialize.iso8601DateTime( - payload.date_authenticated - ); - - this._solution = { fleetSid, sid: sid || this.sid }; - } - - /** - * Contains a 34 character string that uniquely identifies this Device resource. - */ - sid: string; - /** - * Contains an absolute URL for this Device resource. - */ - url: string; - /** - * Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long. - */ - uniqueName: string; - /** - * Contains a human readable descriptive text for this Device, up to 256 characters long - */ - friendlyName: string; - /** - * Specifies the unique string identifier of the Fleet that the given Device belongs to. - */ - fleetSid: string; - /** - * Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false. - */ - enabled: boolean; - /** - * Specifies the unique string identifier of the Account responsible for this Device. - */ - accountSid: string; - /** - * Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long. - */ - identity: string; - /** - * Specifies the unique string identifier of the Deployment group that this Device is associated with. - */ - deploymentSid: string; - /** - * Specifies the date this Device was created, given in UTC ISO 8601 format. - */ - dateCreated: Date; - /** - * Specifies the date this Device was last updated, given in UTC ISO 8601 format. - */ - dateUpdated: Date; - /** - * Specifies the date this Device was last authenticated, given in UTC ISO 8601 format. - */ - dateAuthenticated: Date; - - private get _proxy(): DeviceContext { - this._context = - this._context || - new DeviceContextImpl( - this._version, - this._solution.fleetSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - fetch( - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - update( - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - /** - * Update a DeviceInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - update( - params: DeviceContextUpdateOptions, - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - sid: this.sid, - url: this.url, - uniqueName: this.uniqueName, - friendlyName: this.friendlyName, - fleetSid: this.fleetSid, - enabled: this.enabled, - accountSid: this.accountSid, - identity: this.identity, - deploymentSid: this.deploymentSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - dateAuthenticated: this.dateAuthenticated, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface DeviceSolution { - fleetSid: string; -} - -export interface DeviceListInstance { - _version: DeployedDevices; - _solution: DeviceSolution; - _uri: string; - - (sid: string): DeviceContext; - get(sid: string): DeviceContext; - - /** - * Create a DeviceInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - create( - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - /** - * Create a DeviceInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceInstance - */ - create( - params: DeviceListInstanceCreateOptions, - callback?: (error: Error | null, item?: DeviceInstance) => any - ): Promise; - - /** - * Streams DeviceInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { DeviceListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: DeviceInstance, done: (err?: Error) => void) => void - ): void; - each( - params: DeviceListInstanceEachOptions, - callback?: (item: DeviceInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of DeviceInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: DevicePage) => any - ): Promise; - /** - * Lists DeviceInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { DeviceListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: DeviceInstance[]) => any - ): Promise; - list( - params: DeviceListInstanceOptions, - callback?: (error: Error | null, items: DeviceInstance[]) => any - ): Promise; - /** - * Retrieve a single page of DeviceInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { DeviceListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: DevicePage) => any - ): Promise; - page( - params: DeviceListInstancePageOptions, - callback?: (error: Error | null, items: DevicePage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DeviceListInstance( - version: DeployedDevices, - fleetSid: string -): DeviceListInstance { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as DeviceListInstance; - - instance.get = function get(sid): DeviceContext { - return new DeviceContextImpl(version, fleetSid, sid); - }; - - instance._version = version; - instance._solution = { fleetSid }; - instance._uri = `/Fleets/${fleetSid}/Devices`; - - instance.create = function create( - params?: - | DeviceListInstanceCreateOptions - | ((error: Error | null, items: DeviceInstance) => any), - callback?: (error: Error | null, items: DeviceInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["identity"] !== undefined) data["Identity"] = params["identity"]; - if (params["deploymentSid"] !== undefined) - data["DeploymentSid"] = params["deploymentSid"]; - if (params["enabled"] !== undefined) - data["Enabled"] = serialize.bool(params["enabled"]); - - 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 DeviceInstance( - operationVersion, - payload, - instance._solution.fleetSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | DeviceListInstancePageOptions - | ((error: Error | null, items: DevicePage) => any), - callback?: (error: Error | null, items: DevicePage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["deploymentSid"] !== undefined) - data["DeploymentSid"] = params["deploymentSid"]; - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new DevicePage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: DevicePage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new DevicePage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class DevicePage extends Page< - DeployedDevices, - DevicePayload, - DeviceResource, - DeviceInstance -> { - /** - * Initialize the DevicePage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: DeployedDevices, - response: Response, - solution: DeviceSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of DeviceInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: DeviceResource): DeviceInstance { - return new DeviceInstance(this._version, payload, this._solution.fleetSid); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/preview/deployed_devices/fleet/key.ts b/src/rest/preview/deployed_devices/fleet/key.ts deleted file mode 100644 index 0d334f582b..0000000000 --- a/src/rest/preview/deployed_devices/fleet/key.ts +++ /dev/null @@ -1,717 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import DeployedDevices from "../../DeployedDevices"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -/** - * Options to pass to update a KeyInstance - */ -export interface KeyContextUpdateOptions { - /** Provides a human readable descriptive text for this Key credential, up to 256 characters long. */ - friendlyName?: string; - /** Provides the unique string identifier of an existing Device to become authenticated with this Key credential. */ - deviceSid?: string; -} - -/** - * Options to pass to create a KeyInstance - */ -export interface KeyListInstanceCreateOptions { - /** Provides a human readable descriptive text for this Key credential, up to 256 characters long. */ - friendlyName?: string; - /** Provides the unique string identifier of an existing Device to become authenticated with this Key credential. */ - deviceSid?: string; -} -/** - * Options to pass to each - */ -export interface KeyListInstanceEachOptions { - /** Filters the resulting list of Keys by a unique string identifier of an authenticated Device. */ - deviceSid?: string; - /** 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 */ - callback?: (item: KeyInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface KeyListInstanceOptions { - /** Filters the resulting list of Keys by a unique string identifier of an authenticated Device. */ - deviceSid?: string; - /** 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 */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface KeyListInstancePageOptions { - /** Filters the resulting list of Keys by a unique string identifier of an authenticated Device. */ - deviceSid?: string; - /** 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 */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface KeyContext { - /** - * Remove a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - fetch( - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - - /** - * Update a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - update( - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - /** - * Update a KeyInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - update( - params: KeyContextUpdateOptions, - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface KeyContextSolution { - fleetSid: string; - sid: string; -} - -export class KeyContextImpl implements KeyContext { - protected _solution: KeyContextSolution; - protected _uri: string; - - constructor( - protected _version: DeployedDevices, - fleetSid: string, - sid: string - ) { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { fleetSid, sid }; - this._uri = `/Fleets/${fleetSid}/Keys/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new KeyInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | KeyContextUpdateOptions - | ((error: Error | null, item?: KeyInstance) => any), - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["deviceSid"] !== undefined) - data["DeviceSid"] = params["deviceSid"]; - - 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 KeyInstance( - operationVersion, - payload, - instance._solution.fleetSid, - instance._solution.sid - ) - ); - - 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 KeyPayload extends TwilioResponsePayload { - keys: KeyResource[]; -} - -interface KeyResource { - sid: string; - url: string; - friendly_name: string; - fleet_sid: string; - account_sid: string; - device_sid: string; - secret: string; - date_created: Date; - date_updated: Date; -} - -export class KeyInstance { - protected _solution: KeyContextSolution; - protected _context?: KeyContext; - - constructor( - protected _version: DeployedDevices, - payload: KeyResource, - fleetSid: string, - sid?: string - ) { - this.sid = payload.sid; - this.url = payload.url; - this.friendlyName = payload.friendly_name; - this.fleetSid = payload.fleet_sid; - this.accountSid = payload.account_sid; - this.deviceSid = payload.device_sid; - this.secret = payload.secret; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - - this._solution = { fleetSid, sid: sid || this.sid }; - } - - /** - * Contains a 34 character string that uniquely identifies this Key credential resource. - */ - sid: string; - /** - * Contains an absolute URL for this Key credential resource. - */ - url: string; - /** - * Contains a human readable descriptive text for this Key credential, up to 256 characters long. - */ - friendlyName: string; - /** - * Specifies the unique string identifier of the Fleet that the given Key credential belongs to. - */ - fleetSid: string; - /** - * Specifies the unique string identifier of the Account responsible for this Key credential. - */ - accountSid: string; - /** - * Specifies the unique string identifier of a Device authenticated with this Key credential. - */ - deviceSid: string; - /** - * Contains the automatically generated secret belonging to this Key credential, used to authenticate the Device. - */ - secret: string; - /** - * Specifies the date this Key credential was created, given in UTC ISO 8601 format. - */ - dateCreated: Date; - /** - * Specifies the date this Key credential was last updated, given in UTC ISO 8601 format. - */ - dateUpdated: Date; - - private get _proxy(): KeyContext { - this._context = - this._context || - new KeyContextImpl( - this._version, - this._solution.fleetSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - fetch( - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - update( - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - /** - * Update a KeyInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - update( - params: KeyContextUpdateOptions, - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - sid: this.sid, - url: this.url, - friendlyName: this.friendlyName, - fleetSid: this.fleetSid, - accountSid: this.accountSid, - deviceSid: this.deviceSid, - secret: this.secret, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface KeySolution { - fleetSid: string; -} - -export interface KeyListInstance { - _version: DeployedDevices; - _solution: KeySolution; - _uri: string; - - (sid: string): KeyContext; - get(sid: string): KeyContext; - - /** - * Create a KeyInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - create( - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - /** - * Create a KeyInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed KeyInstance - */ - create( - params: KeyListInstanceCreateOptions, - callback?: (error: Error | null, item?: KeyInstance) => any - ): Promise; - - /** - * Streams KeyInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { KeyListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: KeyInstance, done: (err?: Error) => void) => void - ): void; - each( - params: KeyListInstanceEachOptions, - callback?: (item: KeyInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of KeyInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: KeyPage) => any - ): Promise; - /** - * Lists KeyInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { KeyListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: KeyInstance[]) => any - ): Promise; - list( - params: KeyListInstanceOptions, - callback?: (error: Error | null, items: KeyInstance[]) => any - ): Promise; - /** - * Retrieve a single page of KeyInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { KeyListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: KeyPage) => any - ): Promise; - page( - params: KeyListInstancePageOptions, - callback?: (error: Error | null, items: KeyPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function KeyListInstance( - version: DeployedDevices, - fleetSid: string -): KeyListInstance { - if (!isValidPathParam(fleetSid)) { - throw new Error("Parameter 'fleetSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as KeyListInstance; - - instance.get = function get(sid): KeyContext { - return new KeyContextImpl(version, fleetSid, sid); - }; - - instance._version = version; - instance._solution = { fleetSid }; - instance._uri = `/Fleets/${fleetSid}/Keys`; - - instance.create = function create( - params?: - | KeyListInstanceCreateOptions - | ((error: Error | null, items: KeyInstance) => any), - callback?: (error: Error | null, items: KeyInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["deviceSid"] !== undefined) - data["DeviceSid"] = params["deviceSid"]; - - 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 KeyInstance(operationVersion, payload, instance._solution.fleetSid) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | KeyListInstancePageOptions - | ((error: Error | null, items: KeyPage) => any), - callback?: (error: Error | null, items: KeyPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["deviceSid"] !== undefined) - data["DeviceSid"] = params["deviceSid"]; - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new KeyPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: KeyPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => new KeyPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class KeyPage extends Page< - DeployedDevices, - KeyPayload, - KeyResource, - KeyInstance -> { - /** - * Initialize the KeyPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: DeployedDevices, - response: Response, - solution: KeySolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of KeyInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: KeyResource): KeyInstance { - return new KeyInstance(this._version, payload, this._solution.fleetSid); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/preview/hosted_numbers/authorizationDocument.ts b/src/rest/preview/hosted_numbers/authorizationDocument.ts index 4c49e850ca..e791d277b2 100644 --- a/src/rest/preview/hosted_numbers/authorizationDocument.ts +++ b/src/rest/preview/hosted_numbers/authorizationDocument.ts @@ -203,11 +203,15 @@ export class AuthorizationDocumentContextImpl item?: AuthorizationDocumentInstance ) => any ): Promise { + 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( @@ -262,6 +266,7 @@ export class AuthorizationDocumentContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -652,6 +657,7 @@ export function AuthorizationDocumentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -695,6 +701,7 @@ export function AuthorizationDocumentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.ts b/src/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.ts index e1a712ede7..630abd6d9d 100644 --- a/src/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.ts +++ b/src/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.ts @@ -258,6 +258,7 @@ export function DependentHostedNumberOrderListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/hosted_numbers/hostedNumberOrder.ts b/src/rest/preview/hosted_numbers/hostedNumberOrder.ts index ee9164185f..f907b4bdc0 100644 --- a/src/rest/preview/hosted_numbers/hostedNumberOrder.ts +++ b/src/rest/preview/hosted_numbers/hostedNumberOrder.ts @@ -241,11 +241,14 @@ export class HostedNumberOrderContextImpl implements HostedNumberOrderContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -258,11 +261,15 @@ export class HostedNumberOrderContextImpl implements HostedNumberOrderContext { fetch( callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any ): Promise { + 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( @@ -317,6 +324,7 @@ export class HostedNumberOrderContextImpl implements HostedNumberOrderContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -786,6 +794,7 @@ export function HostedNumberOrderListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -836,6 +845,7 @@ export function HostedNumberOrderListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/marketplace/availableAddOn.ts b/src/rest/preview/marketplace/availableAddOn.ts index 50345400ea..59a2d3b616 100644 --- a/src/rest/preview/marketplace/availableAddOn.ts +++ b/src/rest/preview/marketplace/availableAddOn.ts @@ -110,11 +110,15 @@ export class AvailableAddOnContextImpl implements AvailableAddOnContext { fetch( callback?: (error: Error | null, item?: AvailableAddOnInstance) => any ): Promise { + 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( @@ -385,6 +389,7 @@ export function AvailableAddOnListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/marketplace/availableAddOn/availableAddOnExtension.ts b/src/rest/preview/marketplace/availableAddOn/availableAddOnExtension.ts index ae2b742c54..da9f60ba28 100644 --- a/src/rest/preview/marketplace/availableAddOn/availableAddOnExtension.ts +++ b/src/rest/preview/marketplace/availableAddOn/availableAddOnExtension.ts @@ -115,11 +115,15 @@ export class AvailableAddOnExtensionContextImpl item?: AvailableAddOnExtensionInstance ) => any ): Promise { + 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( @@ -403,6 +407,7 @@ export function AvailableAddOnExtensionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/marketplace/installedAddOn.ts b/src/rest/preview/marketplace/installedAddOn.ts index d1ec97b731..16110d580e 100644 --- a/src/rest/preview/marketplace/installedAddOn.ts +++ b/src/rest/preview/marketplace/installedAddOn.ts @@ -167,11 +167,14 @@ export class InstalledAddOnContextImpl implements InstalledAddOnContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -184,11 +187,15 @@ export class InstalledAddOnContextImpl implements InstalledAddOnContext { fetch( callback?: (error: Error | null, item?: InstalledAddOnInstance) => any ): Promise { + 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( @@ -229,6 +236,7 @@ export class InstalledAddOnContextImpl implements InstalledAddOnContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -603,6 +611,7 @@ export function InstalledAddOnListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -644,6 +653,7 @@ export function InstalledAddOnListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/marketplace/installedAddOn/installedAddOnExtension.ts b/src/rest/preview/marketplace/installedAddOn/installedAddOnExtension.ts index 602e5667e6..448434a3ee 100644 --- a/src/rest/preview/marketplace/installedAddOn/installedAddOnExtension.ts +++ b/src/rest/preview/marketplace/installedAddOn/installedAddOnExtension.ts @@ -138,11 +138,15 @@ export class InstalledAddOnExtensionContextImpl item?: InstalledAddOnExtensionInstance ) => any ): Promise { + 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( @@ -183,6 +187,7 @@ export class InstalledAddOnExtensionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -507,6 +512,7 @@ export function InstalledAddOnExtensionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service.ts b/src/rest/preview/sync/service.ts index 29992cbd07..24aa9a0592 100644 --- a/src/rest/preview/sync/service.ts +++ b/src/rest/preview/sync/service.ts @@ -187,11 +187,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -204,11 +207,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -251,6 +258,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -595,6 +603,7 @@ export function ServiceListInstance(version: Sync): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -636,6 +645,7 @@ export function ServiceListInstance(version: Sync): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/document.ts b/src/rest/preview/sync/service/document.ts index e1f9e02a34..87902b87be 100644 --- a/src/rest/preview/sync/service/document.ts +++ b/src/rest/preview/sync/service/document.ts @@ -159,11 +159,14 @@ export class DocumentContextImpl implements DocumentContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -176,11 +179,15 @@ export class DocumentContextImpl implements DocumentContext { fetch( callback?: (error: Error | null, item?: DocumentInstance) => any ): Promise { + 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( @@ -218,6 +225,7 @@ export class DocumentContextImpl implements DocumentContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -557,6 +565,7 @@ export function DocumentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -603,6 +612,7 @@ export function DocumentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/document/documentPermission.ts b/src/rest/preview/sync/service/document/documentPermission.ts index ef4c458b76..7b361d0a17 100644 --- a/src/rest/preview/sync/service/document/documentPermission.ts +++ b/src/rest/preview/sync/service/document/documentPermission.ts @@ -150,11 +150,14 @@ export class DocumentPermissionContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class DocumentPermissionContextImpl fetch( callback?: (error: Error | null, item?: DocumentPermissionInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class DocumentPermissionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -565,6 +573,7 @@ export function DocumentPermissionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/syncList.ts b/src/rest/preview/sync/service/syncList.ts index ff60cfcd61..e1c95184be 100644 --- a/src/rest/preview/sync/service/syncList.ts +++ b/src/rest/preview/sync/service/syncList.ts @@ -148,11 +148,14 @@ export class SyncListContextImpl implements SyncListContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class SyncListContextImpl implements SyncListContext { fetch( callback?: (error: Error | null, item?: SyncListInstance) => any ): Promise { + 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( @@ -480,6 +487,7 @@ export function SyncListListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -526,6 +534,7 @@ export function SyncListListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/syncList/syncListItem.ts b/src/rest/preview/sync/service/syncList/syncListItem.ts index 2c91e6be62..d859a81332 100644 --- a/src/rest/preview/sync/service/syncList/syncListItem.ts +++ b/src/rest/preview/sync/service/syncList/syncListItem.ts @@ -228,11 +228,15 @@ export class SyncListItemContextImpl implements SyncListItemContext { fetch( callback?: (error: Error | null, item?: SyncListItemInstance) => any ): Promise { + 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( @@ -271,6 +275,7 @@ export class SyncListItemContextImpl implements SyncListItemContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -611,6 +616,7 @@ export function SyncListItemListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -661,6 +667,7 @@ export function SyncListItemListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/syncList/syncListPermission.ts b/src/rest/preview/sync/service/syncList/syncListPermission.ts index 556dd378da..0ef4f24600 100644 --- a/src/rest/preview/sync/service/syncList/syncListPermission.ts +++ b/src/rest/preview/sync/service/syncList/syncListPermission.ts @@ -150,11 +150,14 @@ export class SyncListPermissionContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class SyncListPermissionContextImpl fetch( callback?: (error: Error | null, item?: SyncListPermissionInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class SyncListPermissionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -565,6 +573,7 @@ export function SyncListPermissionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/syncMap.ts b/src/rest/preview/sync/service/syncMap.ts index e06a62bc93..652b14c75e 100644 --- a/src/rest/preview/sync/service/syncMap.ts +++ b/src/rest/preview/sync/service/syncMap.ts @@ -148,11 +148,14 @@ export class SyncMapContextImpl implements SyncMapContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class SyncMapContextImpl implements SyncMapContext { fetch( callback?: (error: Error | null, item?: SyncMapInstance) => any ): Promise { + 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( @@ -480,6 +487,7 @@ export function SyncMapListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -526,6 +534,7 @@ export function SyncMapListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/syncMap/syncMapItem.ts b/src/rest/preview/sync/service/syncMap/syncMapItem.ts index fe03d28a2e..8e0af710ef 100644 --- a/src/rest/preview/sync/service/syncMap/syncMapItem.ts +++ b/src/rest/preview/sync/service/syncMap/syncMapItem.ts @@ -230,11 +230,15 @@ export class SyncMapItemContextImpl implements SyncMapItemContext { fetch( callback?: (error: Error | null, item?: SyncMapItemInstance) => any ): Promise { + 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( @@ -273,6 +277,7 @@ export class SyncMapItemContextImpl implements SyncMapItemContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -619,6 +624,7 @@ export function SyncMapItemListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -669,6 +675,7 @@ export function SyncMapItemListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/sync/service/syncMap/syncMapPermission.ts b/src/rest/preview/sync/service/syncMap/syncMapPermission.ts index e2df61e773..f39cfd3c32 100644 --- a/src/rest/preview/sync/service/syncMap/syncMapPermission.ts +++ b/src/rest/preview/sync/service/syncMap/syncMapPermission.ts @@ -148,11 +148,14 @@ export class SyncMapPermissionContextImpl implements SyncMapPermissionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class SyncMapPermissionContextImpl implements SyncMapPermissionContext { fetch( callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any ): Promise { + 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( @@ -220,6 +227,7 @@ export class SyncMapPermissionContextImpl implements SyncMapPermissionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -563,6 +571,7 @@ export function SyncMapPermissionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/wireless/command.ts b/src/rest/preview/wireless/command.ts index aa96dba648..5f59c2e7ff 100644 --- a/src/rest/preview/wireless/command.ts +++ b/src/rest/preview/wireless/command.ts @@ -138,11 +138,15 @@ export class CommandContextImpl implements CommandContext { fetch( callback?: (error: Error | null, item?: CommandInstance) => any ): Promise { + 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( @@ -409,6 +413,7 @@ export function CommandListInstance(version: Wireless): CommandListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -455,6 +460,7 @@ export function CommandListInstance(version: Wireless): CommandListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/wireless/ratePlan.ts b/src/rest/preview/wireless/ratePlan.ts index db8b4581fc..ebf33c1af5 100644 --- a/src/rest/preview/wireless/ratePlan.ts +++ b/src/rest/preview/wireless/ratePlan.ts @@ -164,11 +164,14 @@ export class RatePlanContextImpl implements RatePlanContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -181,11 +184,15 @@ export class RatePlanContextImpl implements RatePlanContext { fetch( callback?: (error: Error | null, item?: RatePlanInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class RatePlanContextImpl implements RatePlanContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -576,6 +584,7 @@ export function RatePlanListInstance(version: Wireless): RatePlanListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -617,6 +626,7 @@ export function RatePlanListInstance(version: Wireless): RatePlanListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/wireless/sim.ts b/src/rest/preview/wireless/sim.ts index 6fe57c8664..5466cefac9 100644 --- a/src/rest/preview/wireless/sim.ts +++ b/src/rest/preview/wireless/sim.ts @@ -196,11 +196,15 @@ export class SimContextImpl implements SimContext { fetch( callback?: (error: Error | null, item?: SimInstance) => any ): Promise { + 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( @@ -261,6 +265,7 @@ export class SimContextImpl implements SimContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -601,6 +606,7 @@ export function SimListInstance(version: Wireless): SimListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/preview/wireless/sim/usage.ts b/src/rest/preview/wireless/sim/usage.ts index a3b17eb51d..e6c6598b23 100644 --- a/src/rest/preview/wireless/sim/usage.ts +++ b/src/rest/preview/wireless/sim/usage.ts @@ -95,6 +95,7 @@ export class UsageContextImpl implements UsageContext { if (params["start"] !== undefined) data["Start"] = params["start"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/previewIam/V1.ts b/src/rest/previewIam/V1.ts new file mode 100644 index 0000000000..6a27dc8200 --- /dev/null +++ b/src/rest/previewIam/V1.ts @@ -0,0 +1,46 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import PreviewIamBase from "../PreviewIamBase"; +import Version from "../../base/Version"; +import { AuthorizeListInstance } from "./v1/authorize"; +import { TokenListInstance } from "./v1/token"; + +export default class V1 extends Version { + /** + * Initialize the V1 version of PreviewIam + * + * @param domain - The Twilio (Twilio.PreviewIam) domain + */ + constructor(domain: PreviewIamBase) { + super(domain, "v1"); + } + + /** authorize - { Twilio.PreviewIam.V1.AuthorizeListInstance } resource */ + protected _authorize?: AuthorizeListInstance; + /** token - { Twilio.PreviewIam.V1.TokenListInstance } resource */ + protected _token?: TokenListInstance; + + /** Getter for authorize resource */ + get authorize(): AuthorizeListInstance { + this._authorize = this._authorize || AuthorizeListInstance(this); + return this._authorize; + } + + /** Getter for token resource */ + get token(): TokenListInstance { + this._token = this._token || TokenListInstance(this); + return this._token; + } +} diff --git a/src/rest/previewIam/Versionless.ts b/src/rest/previewIam/Versionless.ts new file mode 100644 index 0000000000..57a41e82e6 --- /dev/null +++ b/src/rest/previewIam/Versionless.ts @@ -0,0 +1,37 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import PreviewIamBase from "../PreviewIamBase"; +import Version from "../../base/Version"; +import { OrganizationListInstance } from "./versionless/organization"; + +export default class Versionless extends Version { + /** + * Initialize the Versionless version of PreviewIam + * + * @param domain - The Twilio (Twilio.PreviewIam) domain + */ + constructor(domain: PreviewIamBase) { + super(domain, "Organizations"); + } + + /** organization - { Twilio.PreviewIam.Versionless.OrganizationListInstance } resource */ + protected _organization?: OrganizationListInstance; + + /** Getter for organization resource */ + get organization(): OrganizationListInstance { + this._organization = this._organization || OrganizationListInstance(this); + return this._organization; + } +} diff --git a/src/rest/previewIam/v1/authorize.ts b/src/rest/previewIam/v1/authorize.ts new file mode 100644 index 0000000000..df8915e796 --- /dev/null +++ b/src/rest/previewIam/v1/authorize.ts @@ -0,0 +1,171 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 fetch a AuthorizeInstance + */ +export interface AuthorizeListInstanceFetchOptions { + /** Response Type */ + responseType?: string; + /** The Client Identifier */ + clientId?: string; + /** The url to which response will be redirected to */ + redirectUri?: string; + /** The scope of the access request */ + scope?: string; + /** An opaque value which can be used to maintain state between the request and callback */ + state?: string; +} + +export interface AuthorizeSolution {} + +export interface AuthorizeListInstance { + _version: V1; + _solution: AuthorizeSolution; + _uri: string; + + /** + * Fetch a AuthorizeInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AuthorizeInstance + */ + fetch( + callback?: (error: Error | null, item?: AuthorizeInstance) => any + ): Promise; + /** + * Fetch a AuthorizeInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AuthorizeInstance + */ + fetch( + params: AuthorizeListInstanceFetchOptions, + callback?: (error: Error | null, item?: AuthorizeInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function AuthorizeListInstance(version: V1): AuthorizeListInstance { + const instance = {} as AuthorizeListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/authorize`; + + instance.fetch = function fetch( + params?: + | AuthorizeListInstanceFetchOptions + | ((error: Error | null, items: AuthorizeInstance) => any), + callback?: (error: Error | null, items: AuthorizeInstance) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["responseType"] !== undefined) + data["response_type"] = params["responseType"]; + if (params["clientId"] !== undefined) + data["client_id"] = params["clientId"]; + if (params["redirectUri"] !== undefined) + data["redirect_uri"] = params["redirectUri"]; + if (params["scope"] !== undefined) data["scope"] = params["scope"]; + if (params["state"] !== undefined) data["state"] = params["state"]; + + const headers: any = {}; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.fetch({ + uri: instance._uri, + method: "get", + params: data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new AuthorizeInstance(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; +} + +interface AuthorizePayload extends AuthorizeResource {} + +interface AuthorizeResource { + redirect_to: string; +} + +export class AuthorizeInstance { + constructor(protected _version: V1, payload: AuthorizeResource) { + this.redirectTo = payload.redirect_to; + } + + /** + * The callback URL + */ + redirectTo: string; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + redirectTo: this.redirectTo, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/previewIam/v1/token.ts b/src/rest/previewIam/v1/token.ts new file mode 100644 index 0000000000..4e40089a44 --- /dev/null +++ b/src/rest/previewIam/v1/token.ts @@ -0,0 +1,200 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 create a TokenInstance + */ +export interface TokenListInstanceCreateOptions { + /** Grant type is a credential representing resource owner\\\'s authorization which can be used by client to obtain access token. */ + grantType: string; + /** A 34 character string that uniquely identifies this OAuth App. */ + clientId: string; + /** The credential for confidential OAuth App. */ + clientSecret?: string; + /** JWT token related to the authorization code grant type. */ + code?: string; + /** The redirect uri */ + redirectUri?: string; + /** The targeted audience uri */ + audience?: string; + /** JWT token related to refresh access token. */ + refreshToken?: string; + /** The scope of token */ + scope?: string; +} + +export interface TokenSolution {} + +export interface TokenListInstance { + _version: V1; + _solution: TokenSolution; + _uri: string; + + /** + * Create a TokenInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed TokenInstance + */ + create( + params: TokenListInstanceCreateOptions, + callback?: (error: Error | null, item?: TokenInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function TokenListInstance(version: V1): TokenListInstance { + const instance = {} as TokenListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/token`; + + instance.create = function create( + params: TokenListInstanceCreateOptions, + callback?: (error: Error | null, items: TokenInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["grantType"] === null || params["grantType"] === undefined) { + throw new Error("Required parameter \"params['grantType']\" missing."); + } + + if (params["clientId"] === null || params["clientId"] === undefined) { + throw new Error("Required parameter \"params['clientId']\" missing."); + } + + let data: any = {}; + + data["grant_type"] = params["grantType"]; + + data["client_id"] = params["clientId"]; + if (params["clientSecret"] !== undefined) + data["client_secret"] = params["clientSecret"]; + if (params["code"] !== undefined) data["code"] = params["code"]; + if (params["redirectUri"] !== undefined) + data["redirect_uri"] = params["redirectUri"]; + if (params["audience"] !== undefined) data["audience"] = params["audience"]; + if (params["refreshToken"] !== undefined) + data["refresh_token"] = params["refreshToken"]; + if (params["scope"] !== undefined) data["scope"] = params["scope"]; + + const headers: any = {}; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new TokenInstance(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; +} + +interface TokenPayload extends TokenResource {} + +interface TokenResource { + access_token: string; + refresh_token: string; + id_token: string; + token_type: string; + expires_in: number; +} + +export class TokenInstance { + constructor(protected _version: V1, payload: TokenResource) { + this.accessToken = payload.access_token; + this.refreshToken = payload.refresh_token; + this.idToken = payload.id_token; + this.tokenType = payload.token_type; + this.expiresIn = payload.expires_in; + } + + /** + * Token which carries the necessary information to access a Twilio resource directly. + */ + accessToken: string; + /** + * Token which carries the information necessary to get a new access token. + */ + refreshToken: string; + /** + * Token which carries the information necessary of user profile. + */ + idToken: string; + /** + * Token type + */ + tokenType: string; + expiresIn: number; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accessToken: this.accessToken, + refreshToken: this.refreshToken, + idToken: this.idToken, + tokenType: this.tokenType, + expiresIn: this.expiresIn, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/previewIam/versionless/organization.ts b/src/rest/previewIam/versionless/organization.ts new file mode 100644 index 0000000000..c5cbaa5242 --- /dev/null +++ b/src/rest/previewIam/versionless/organization.ts @@ -0,0 +1,135 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 Versionless from "../Versionless"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; +import { AccountListInstance } from "./organization/account"; +import { RoleAssignmentListInstance } from "./organization/roleAssignment"; +import { UserListInstance } from "./organization/user"; + +export interface OrganizationContext { + accounts: AccountListInstance; + roleAssignments: RoleAssignmentListInstance; + users: UserListInstance; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface OrganizationContextSolution { + organizationSid: string; +} + +export class OrganizationContextImpl implements OrganizationContext { + protected _solution: OrganizationContextSolution; + protected _uri: string; + + protected _accounts?: AccountListInstance; + protected _roleAssignments?: RoleAssignmentListInstance; + protected _users?: UserListInstance; + + constructor(protected _version: Versionless, organizationSid: string) { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + this._solution = { organizationSid }; + this._uri = `/${organizationSid}`; + } + + get accounts(): AccountListInstance { + this._accounts = + this._accounts || + AccountListInstance(this._version, this._solution.organizationSid); + return this._accounts; + } + + get roleAssignments(): RoleAssignmentListInstance { + this._roleAssignments = + this._roleAssignments || + RoleAssignmentListInstance(this._version, this._solution.organizationSid); + return this._roleAssignments; + } + + get users(): UserListInstance { + this._users = + this._users || + UserListInstance(this._version, this._solution.organizationSid); + return this._users; + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return this._solution; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface OrganizationSolution {} + +export interface OrganizationListInstance { + _version: Versionless; + _solution: OrganizationSolution; + _uri: string; + + (organizationSid: string): OrganizationContext; + get(organizationSid: string): OrganizationContext; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function OrganizationListInstance( + version: Versionless +): OrganizationListInstance { + const instance = ((organizationSid) => + instance.get(organizationSid)) as OrganizationListInstance; + + instance.get = function get(organizationSid): OrganizationContext { + return new OrganizationContextImpl(version, organizationSid); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = ``; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} diff --git a/src/rest/previewIam/versionless/organization/account.ts b/src/rest/previewIam/versionless/organization/account.ts new file mode 100644 index 0000000000..50db38f497 --- /dev/null +++ b/src/rest/previewIam/versionless/organization/account.ts @@ -0,0 +1,471 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; +import Response from "../../../../http/response"; +import Versionless from "../../Versionless"; +const deserialize = require("../../../../base/deserialize"); +const serialize = require("../../../../base/serialize"); +import { isValidPathParam } from "../../../../base/utility"; + +/** + * Options to pass to each + */ +export interface AccountListInstanceEachOptions { + /** */ + pageSize?: number; + /** Function to process each record. If this and a positional callback are passed, this one will be used */ + callback?: (item: AccountInstance, done: (err?: Error) => void) => void; + /** Function to be called upon completion of streaming */ + done?: Function; + /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to list + */ +export interface AccountListInstanceOptions { + /** */ + pageSize?: number; + /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to page + */ +export interface AccountListInstancePageOptions { + /** */ + pageSize?: number; + /** Page Number, this value is simply for client state */ + pageNumber?: number; + /** PageToken provided by the API */ + pageToken?: string; +} + +export interface AccountContext { + /** + * Fetch a AccountInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AccountInstance + */ + fetch( + callback?: (error: Error | null, item?: AccountInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface AccountContextSolution { + organizationSid: string; + accountSid: string; +} + +export class AccountContextImpl implements AccountContext { + protected _solution: AccountContextSolution; + protected _uri: string; + + constructor( + protected _version: Versionless, + organizationSid: string, + accountSid: string + ) { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + if (!isValidPathParam(accountSid)) { + throw new Error("Parameter 'accountSid' is not valid."); + } + + this._solution = { organizationSid, accountSid }; + this._uri = `/${organizationSid}/Accounts/${accountSid}`; + } + + fetch( + callback?: (error: Error | null, item?: AccountInstance) => any + ): Promise { + 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( + (payload) => + new AccountInstance( + operationVersion, + payload, + instance._solution.organizationSid, + instance._solution.accountSid + ) + ); + + 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 AccountPayload extends TwilioResponsePayload { + content: AccountResource[]; +} + +interface AccountResource { + account_sid: string; + friendly_name: string; + status: string; + owner_sid: string; + date_created: Date; +} + +/** + * Page content + */ +export class AccountInstance { + protected _solution: AccountContextSolution; + protected _context?: AccountContext; + + constructor( + protected _version: Versionless, + payload: AccountResource, + organizationSid: string, + accountSid?: string + ) { + this.accountSid = payload.account_sid; + this.friendlyName = payload.friendly_name; + this.status = payload.status; + this.ownerSid = payload.owner_sid; + this.dateCreated = deserialize.iso8601DateTime(payload.date_created); + + this._solution = { + organizationSid, + accountSid: accountSid || this.accountSid, + }; + } + + /** + * Twilio account sid + */ + accountSid: string; + /** + * Account friendly name + */ + friendlyName: string; + /** + * Account status + */ + status: string; + /** + * Twilio account sid + */ + ownerSid: string; + /** + * The date and time when the account was created in the system + */ + dateCreated: Date; + + private get _proxy(): AccountContext { + this._context = + this._context || + new AccountContextImpl( + this._version, + this._solution.organizationSid, + this._solution.accountSid + ); + return this._context; + } + + /** + * Fetch a AccountInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed AccountInstance + */ + fetch( + callback?: (error: Error | null, item?: AccountInstance) => any + ): Promise { + return this._proxy.fetch(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + accountSid: this.accountSid, + friendlyName: this.friendlyName, + status: this.status, + ownerSid: this.ownerSid, + dateCreated: this.dateCreated, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface AccountSolution { + organizationSid: string; +} + +export interface AccountListInstance { + _version: Versionless; + _solution: AccountSolution; + _uri: string; + + (accountSid: string): AccountContext; + get(accountSid: string): AccountContext; + + /** + * Streams AccountInstance records from the API. + * + * This operation lazily loads records as efficiently as possible until the limit + * is reached. + * + * The results are passed into the callback function, so this operation is memory + * efficient. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AccountListInstanceEachOptions } [params] - Options for request + * @param { function } [callback] - Function to process each record + */ + each( + callback?: (item: AccountInstance, done: (err?: Error) => void) => void + ): void; + each( + params: AccountListInstanceEachOptions, + callback?: (item: AccountInstance, done: (err?: Error) => void) => void + ): void; + /** + * Retrieve a single target page of AccountInstance records from the API. + * + * The request is executed immediately. + * + * @param { string } [targetUrl] - API-generated URL for the requested results page + * @param { function } [callback] - Callback to handle list of records + */ + getPage( + targetUrl: string, + callback?: (error: Error | null, items: AccountPage) => any + ): Promise; + /** + * Lists AccountInstance records from the API as a list. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AccountListInstanceOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + list( + callback?: (error: Error | null, items: AccountInstance[]) => any + ): Promise; + list( + params: AccountListInstanceOptions, + callback?: (error: Error | null, items: AccountInstance[]) => any + ): Promise; + /** + * Retrieve a single page of AccountInstance records from the API. + * + * The request is executed immediately. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { AccountListInstancePageOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + page( + callback?: (error: Error | null, items: AccountPage) => any + ): Promise; + page( + params: AccountListInstancePageOptions, + callback?: (error: Error | null, items: AccountPage) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function AccountListInstance( + version: Versionless, + organizationSid: string +): AccountListInstance { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + const instance = ((accountSid) => + instance.get(accountSid)) as AccountListInstance; + + instance.get = function get(accountSid): AccountContext { + return new AccountContextImpl(version, organizationSid, accountSid); + }; + + instance._version = version; + instance._solution = { organizationSid }; + instance._uri = `/${organizationSid}/Accounts`; + + instance.page = function page( + params?: + | AccountListInstancePageOptions + | ((error: Error | null, items: AccountPage) => any), + callback?: (error: Error | null, items: AccountPage) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; + + if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; + if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; + + const headers: any = {}; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.page({ + uri: instance._uri, + method: "get", + params: data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new AccountPage(operationVersion, payload, instance._solution) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + instance.each = instance._version.each; + instance.list = instance._version.list; + + instance.getPage = function getPage( + targetUrl: string, + callback?: (error: Error | null, items: AccountPage) => any + ): Promise { + const operationPromise = instance._version._domain.twilio.request({ + method: "get", + uri: targetUrl, + }); + + let pagePromise = operationPromise.then( + (payload) => + new AccountPage(instance._version, payload, instance._solution) + ); + pagePromise = instance._version.setPromiseCallback(pagePromise, callback); + return pagePromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +export class AccountPage extends Page< + Versionless, + AccountPayload, + AccountResource, + AccountInstance +> { + /** + * Initialize the AccountPage + * + * @param version - Version of the resource + * @param response - Response from the API + * @param solution - Path solution + */ + constructor( + version: Versionless, + response: Response, + solution: AccountSolution + ) { + super(version, response, solution); + } + + /** + * Build an instance of AccountInstance + * + * @param payload - Payload response from the API + */ + getInstance(payload: AccountResource): AccountInstance { + return new AccountInstance( + this._version, + payload, + this._solution.organizationSid + ); + } + + [inspect.custom](depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/previewIam/versionless/organization/roleAssignment.ts b/src/rest/previewIam/versionless/organization/roleAssignment.ts new file mode 100644 index 0000000000..dff3be9670 --- /dev/null +++ b/src/rest/previewIam/versionless/organization/roleAssignment.ts @@ -0,0 +1,578 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; +import Response from "../../../../http/response"; +import Versionless from "../../Versionless"; +const deserialize = require("../../../../base/deserialize"); +const serialize = require("../../../../base/serialize"); +import { isValidPathParam } from "../../../../base/utility"; + +export class PublicApiCreateRoleAssignmentRequest { + /** + * Twilio Role Sid representing assigned role + */ + "role_sid": string; + /** + * Twilio Sid representing scope of this assignment + */ + "scope": string; + /** + * Twilio Sid representing identity of this assignment + */ + "identity": string; +} + +/** + * Options to pass to create a RoleAssignmentInstance + */ +export interface RoleAssignmentListInstanceCreateOptions { + /** */ + publicApiCreateRoleAssignmentRequest: PublicApiCreateRoleAssignmentRequest; +} +/** + * Options to pass to each + */ +export interface RoleAssignmentListInstanceEachOptions { + /** */ + pageSize?: number; + /** */ + identity?: string; + /** */ + scope?: string; + /** Function to process each record. If this and a positional callback are passed, this one will be used */ + callback?: ( + item: RoleAssignmentInstance, + done: (err?: Error) => void + ) => void; + /** Function to be called upon completion of streaming */ + done?: Function; + /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to list + */ +export interface RoleAssignmentListInstanceOptions { + /** */ + pageSize?: number; + /** */ + identity?: string; + /** */ + scope?: string; + /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to page + */ +export interface RoleAssignmentListInstancePageOptions { + /** */ + pageSize?: number; + /** */ + identity?: string; + /** */ + scope?: string; + /** Page Number, this value is simply for client state */ + pageNumber?: number; + /** PageToken provided by the API */ + pageToken?: string; +} + +export interface RoleAssignmentContext { + /** + * Remove a RoleAssignmentInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface RoleAssignmentContextSolution { + organizationSid: string; + sid: string; +} + +export class RoleAssignmentContextImpl implements RoleAssignmentContext { + protected _solution: RoleAssignmentContextSolution; + protected _uri: string; + + constructor( + protected _version: Versionless, + organizationSid: string, + sid: string + ) { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + if (!isValidPathParam(sid)) { + throw new Error("Parameter 'sid' is not valid."); + } + + this._solution = { organizationSid, sid }; + this._uri = `/${organizationSid}/RoleAssignments/${sid}`; + } + + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + const headers: any = {}; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.remove({ + uri: instance._uri, + method: "delete", + headers, + }); + + 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 RoleAssignmentPayload extends TwilioResponsePayload { + content: RoleAssignmentResource[]; +} + +interface RoleAssignmentResource { + sid: string; + role_sid: string; + scope: string; + identity: string; + code: number; + message: string; + moreInfo: string; + status: number; +} + +export class RoleAssignmentInstance { + protected _solution: RoleAssignmentContextSolution; + protected _context?: RoleAssignmentContext; + + constructor( + protected _version: Versionless, + payload: RoleAssignmentResource, + organizationSid: string, + sid?: string + ) { + this.sid = payload.sid; + this.roleSid = payload.role_sid; + this.scope = payload.scope; + this.identity = payload.identity; + this.code = payload.code; + this.message = payload.message; + this.moreInfo = payload.moreInfo; + this.status = payload.status; + + this._solution = { organizationSid, sid: sid || this.sid }; + } + + /** + * Twilio Role Assignment Sid representing this role assignment + */ + sid: string; + /** + * Twilio Role Sid representing assigned role + */ + roleSid: string; + /** + * Twilio Sid representing identity of this assignment + */ + scope: string; + /** + * Twilio Sid representing scope of this assignment + */ + identity: string; + /** + * Twilio-specific error code + */ + code: number; + /** + * Error message + */ + message: string; + /** + * Link to Error Code References + */ + moreInfo: string; + /** + * HTTP response status code + */ + status: number; + + private get _proxy(): RoleAssignmentContext { + this._context = + this._context || + new RoleAssignmentContextImpl( + this._version, + this._solution.organizationSid, + this._solution.sid + ); + return this._context; + } + + /** + * Remove a RoleAssignmentInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + return this._proxy.remove(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + sid: this.sid, + roleSid: this.roleSid, + scope: this.scope, + identity: this.identity, + code: this.code, + message: this.message, + moreInfo: this.moreInfo, + status: this.status, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface RoleAssignmentSolution { + organizationSid: string; +} + +export interface RoleAssignmentListInstance { + _version: Versionless; + _solution: RoleAssignmentSolution; + _uri: string; + + (sid: string): RoleAssignmentContext; + get(sid: string): RoleAssignmentContext; + + /** + * Create a RoleAssignmentInstance + * + * @param params - Body for request + * @param headers - header params for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed RoleAssignmentInstance + */ + create( + params: PublicApiCreateRoleAssignmentRequest, + headers?: any, + callback?: (error: Error | null, item?: RoleAssignmentInstance) => any + ): Promise; + + /** + * Streams RoleAssignmentInstance records from the API. + * + * This operation lazily loads records as efficiently as possible until the limit + * is reached. + * + * The results are passed into the callback function, so this operation is memory + * efficient. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { RoleAssignmentListInstanceEachOptions } [params] - Options for request + * @param { function } [callback] - Function to process each record + */ + each( + callback?: ( + item: RoleAssignmentInstance, + done: (err?: Error) => void + ) => void + ): void; + each( + params: RoleAssignmentListInstanceEachOptions, + callback?: ( + item: RoleAssignmentInstance, + done: (err?: Error) => void + ) => void + ): void; + /** + * Retrieve a single target page of RoleAssignmentInstance records from the API. + * + * The request is executed immediately. + * + * @param { string } [targetUrl] - API-generated URL for the requested results page + * @param { function } [callback] - Callback to handle list of records + */ + getPage( + targetUrl: string, + callback?: (error: Error | null, items: RoleAssignmentPage) => any + ): Promise; + /** + * Lists RoleAssignmentInstance records from the API as a list. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { RoleAssignmentListInstanceOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + list( + callback?: (error: Error | null, items: RoleAssignmentInstance[]) => any + ): Promise; + list( + params: RoleAssignmentListInstanceOptions, + callback?: (error: Error | null, items: RoleAssignmentInstance[]) => any + ): Promise; + /** + * Retrieve a single page of RoleAssignmentInstance records from the API. + * + * The request is executed immediately. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { RoleAssignmentListInstancePageOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + page( + callback?: (error: Error | null, items: RoleAssignmentPage) => any + ): Promise; + page( + params: RoleAssignmentListInstancePageOptions, + callback?: (error: Error | null, items: RoleAssignmentPage) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function RoleAssignmentListInstance( + version: Versionless, + organizationSid: string +): RoleAssignmentListInstance { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + const instance = ((sid) => instance.get(sid)) as RoleAssignmentListInstance; + + instance.get = function get(sid): RoleAssignmentContext { + return new RoleAssignmentContextImpl(version, organizationSid, sid); + }; + + instance._version = version; + instance._solution = { organizationSid }; + instance._uri = `/${organizationSid}/RoleAssignments`; + + instance.create = function create( + params: PublicApiCreateRoleAssignmentRequest, + headers?: any, + callback?: (error: Error | null, items: RoleAssignmentInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + let data: any = {}; + + data = params; + + if (headers === null || headers === undefined) { + headers = {}; + } + + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new RoleAssignmentInstance( + operationVersion, + payload, + instance._solution.organizationSid + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + + instance.page = function page( + params?: + | RoleAssignmentListInstancePageOptions + | ((error: Error | null, items: RoleAssignmentPage) => any), + callback?: (error: Error | null, items: RoleAssignmentPage) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; + if (params["identity"] !== undefined) data["Identity"] = params["identity"]; + if (params["scope"] !== undefined) data["Scope"] = params["scope"]; + + if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; + if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; + + const headers: any = {}; + headers["Accept"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.page({ + uri: instance._uri, + method: "get", + params: data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new RoleAssignmentPage(operationVersion, payload, instance._solution) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + instance.each = instance._version.each; + instance.list = instance._version.list; + + instance.getPage = function getPage( + targetUrl: string, + callback?: (error: Error | null, items: RoleAssignmentPage) => any + ): Promise { + const operationPromise = instance._version._domain.twilio.request({ + method: "get", + uri: targetUrl, + }); + + let pagePromise = operationPromise.then( + (payload) => + new RoleAssignmentPage(instance._version, payload, instance._solution) + ); + pagePromise = instance._version.setPromiseCallback(pagePromise, callback); + return pagePromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +export class RoleAssignmentPage extends Page< + Versionless, + RoleAssignmentPayload, + RoleAssignmentResource, + RoleAssignmentInstance +> { + /** + * Initialize the RoleAssignmentPage + * + * @param version - Version of the resource + * @param response - Response from the API + * @param solution - Path solution + */ + constructor( + version: Versionless, + response: Response, + solution: RoleAssignmentSolution + ) { + super(version, response, solution); + } + + /** + * Build an instance of RoleAssignmentInstance + * + * @param payload - Payload response from the API + */ + getInstance(payload: RoleAssignmentResource): RoleAssignmentInstance { + return new RoleAssignmentInstance( + this._version, + payload, + this._solution.organizationSid + ); + } + + [inspect.custom](depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/previewIam/versionless/organization/user.ts b/src/rest/previewIam/versionless/organization/user.ts new file mode 100644 index 0000000000..5d8e3e970b --- /dev/null +++ b/src/rest/previewIam/versionless/organization/user.ts @@ -0,0 +1,851 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Organization Public API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; +import Response from "../../../../http/response"; +import Versionless from "../../Versionless"; +const deserialize = require("../../../../base/deserialize"); +const serialize = require("../../../../base/serialize"); +import { isValidPathParam } from "../../../../base/utility"; + +/** + * Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + */ +export class ScimEmailAddress { + /** + * Indicates if this email address is the primary one + */ + "primary"?: boolean; + /** + * The actual email address value + */ + "value"?: string; + /** + * The type of email address (e.g., work, home, etc.) + */ + "type"?: string; +} + +/** + * Meta + */ +export class ScimMeta { + /** + * Indicates the type of the resource + */ + "resourceType"?: string; + /** + * The date and time when the resource was created in the system + */ + "created"?: Date; + /** + * The date and time when the resource was last modified + */ + "lastModified"?: Date; + /** + * A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + */ + "version"?: string; +} + +/** + * User\'s name + */ +export class ScimName { + /** + * The user\'s first or given name + */ + "givenName"?: string; + /** + * The user\'s last or family name + */ + "familyName"?: string; +} + +export class ScimUser { + /** + * Unique Twilio user sid + */ + "id"?: string; + /** + * External unique resource id defined by provisioning client + */ + "externalId"?: string; + /** + * Unique username, MUST be same as primary email address + */ + "userName": string; + /** + * User friendly display name + */ + "displayName"?: string; + "name"?: ScimName; + /** + * Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + */ + "emails"?: Array; + /** + * Indicates whether the user is active + */ + "active"?: boolean; + /** + * User\'s locale + */ + "locale"?: string; + /** + * User\'s time zone + */ + "timezone"?: string; + /** + * An array of URIs that indicate the schemas supported for this user resource + */ + "schemas"?: Array; + "meta"?: ScimMeta; + /** + * A human-readable description of the error + */ + "detail"?: string; + /** + * A scimType error code as defined in RFC7644 + */ + "scimType"?: string; + /** + * Http status code + */ + "status"?: string; + /** + * Twilio-specific error code + */ + "code"?: number; + /** + * Link to Error Code References + */ + "moreInfo"?: string; +} + +/** + * Options to pass to update a UserInstance + */ +export interface UserContextUpdateOptions { + /** */ + scimUser: ScimUser; + /** */ + ifMatch?: string; +} + +/** + * Options to pass to create a UserInstance + */ +export interface UserListInstanceCreateOptions { + /** */ + scimUser: ScimUser; +} +/** + * Options to pass to each + */ +export interface UserListInstanceEachOptions { + /** */ + filter?: string; + /** Function to process each record. If this and a positional callback are passed, this one will be used */ + callback?: (item: UserInstance, done: (err?: Error) => void) => void; + /** Function to be called upon completion of streaming */ + done?: Function; + /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to list + */ +export interface UserListInstanceOptions { + /** */ + filter?: string; + /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ + limit?: number; +} + +/** + * Options to pass to page + */ +export interface UserListInstancePageOptions { + /** */ + filter?: string; + /** Page Number, this value is simply for client state */ + pageNumber?: number; + /** PageToken provided by the API */ + pageToken?: string; +} + +export interface UserContext { + /** + * Remove a UserInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise; + + /** + * Fetch a UserInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed UserInstance + */ + fetch( + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise; + + /** + * Update a UserInstance + * + * @param params - Body for request + * @param headers - header params for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed UserInstance + */ + update( + params: ScimUser, + headers?: any, + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface UserContextSolution { + organizationSid: string; + id: string; +} + +export class UserContextImpl implements UserContext { + protected _solution: UserContextSolution; + protected _uri: string; + + constructor( + protected _version: Versionless, + organizationSid: string, + id: string + ) { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + if (!isValidPathParam(id)) { + throw new Error("Parameter 'id' is not valid."); + } + + this._solution = { organizationSid, id }; + this._uri = `/${organizationSid}/scim/Users/${id}`; + } + + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + const headers: any = {}; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.remove({ + uri: instance._uri, + method: "delete", + headers, + }); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + fetch( + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise { + const headers: any = {}; + headers["Accept"] = "application/scim+json"; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.fetch({ + uri: instance._uri, + method: "get", + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new UserInstance( + operationVersion, + payload, + instance._solution.organizationSid, + instance._solution.id + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + update( + params: ScimUser, + headers?: any, + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + let data: any = {}; + + data = params; + + if (headers === null || headers === undefined) { + headers = {}; + } + + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/scim+json"; + + const instance = this; + let operationVersion = instance._version, + operationPromise = operationVersion.update({ + uri: instance._uri, + method: "put", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new UserInstance( + operationVersion, + payload, + instance._solution.organizationSid, + instance._solution.id + ) + ); + + 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 UserPayload extends TwilioResponsePayload { + Resources: UserResource[]; +} + +interface UserResource { + id: string; + externalId: string; + userName: string; + displayName: string; + name: ScimName; + emails: Array; + active: boolean; + locale: string; + timezone: string; + schemas: Array; + meta: ScimMeta; + detail: string; + scimType: string; + status: string; + code: number; + moreInfo: string; +} + +export class UserInstance { + protected _solution: UserContextSolution; + protected _context?: UserContext; + + constructor( + protected _version: Versionless, + payload: UserResource, + organizationSid: string, + id?: string + ) { + this.id = payload.id; + this.externalId = payload.externalId; + this.userName = payload.userName; + this.displayName = payload.displayName; + this.name = payload.name; + this.emails = payload.emails; + this.active = payload.active; + this.locale = payload.locale; + this.timezone = payload.timezone; + this.schemas = payload.schemas; + this.meta = payload.meta; + this.detail = payload.detail; + this.scimType = payload.scimType; + this.status = payload.status; + this.code = payload.code; + this.moreInfo = payload.moreInfo; + + this._solution = { organizationSid, id: id || this.id }; + } + + /** + * Unique Twilio user sid + */ + id: string; + /** + * External unique resource id defined by provisioning client + */ + externalId: string; + /** + * Unique username, MUST be same as primary email address + */ + userName: string; + /** + * User friendly display name + */ + displayName: string; + name: ScimName; + /** + * Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + */ + emails: Array; + /** + * Indicates whether the user is active + */ + active: boolean; + /** + * User\'s locale + */ + locale: string; + /** + * User\'s time zone + */ + timezone: string; + /** + * An array of URIs that indicate the schemas supported for this user resource + */ + schemas: Array; + meta: ScimMeta; + /** + * A human-readable description of the error + */ + detail: string; + /** + * A scimType error code as defined in RFC7644 + */ + scimType: string; + /** + * Http status code + */ + status: string; + /** + * Twilio-specific error code + */ + code: number; + /** + * Link to Error Code References + */ + moreInfo: string; + + private get _proxy(): UserContext { + this._context = + this._context || + new UserContextImpl( + this._version, + this._solution.organizationSid, + this._solution.id + ); + return this._context; + } + + /** + * Remove a UserInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + return this._proxy.remove(callback); + } + + /** + * Fetch a UserInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed UserInstance + */ + fetch( + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise { + return this._proxy.fetch(callback); + } + + /** + * Update a UserInstance + * + * @param params - Body for request + * @param headers - header params for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed UserInstance + */ + update( + params: ScimUser, + headers?: any, + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise; + + update( + params?: any, + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise { + return this._proxy.update(params, callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + id: this.id, + externalId: this.externalId, + userName: this.userName, + displayName: this.displayName, + name: this.name, + emails: this.emails, + active: this.active, + locale: this.locale, + timezone: this.timezone, + schemas: this.schemas, + meta: this.meta, + detail: this.detail, + scimType: this.scimType, + status: this.status, + code: this.code, + moreInfo: this.moreInfo, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface UserSolution { + organizationSid: string; +} + +export interface UserListInstance { + _version: Versionless; + _solution: UserSolution; + _uri: string; + + (id: string): UserContext; + get(id: string): UserContext; + + /** + * Create a UserInstance + * + * @param params - Body for request + * @param headers - header params for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed UserInstance + */ + create( + params: ScimUser, + headers?: any, + callback?: (error: Error | null, item?: UserInstance) => any + ): Promise; + + /** + * Streams UserInstance records from the API. + * + * This operation lazily loads records as efficiently as possible until the limit + * is reached. + * + * The results are passed into the callback function, so this operation is memory + * efficient. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { UserListInstanceEachOptions } [params] - Options for request + * @param { function } [callback] - Function to process each record + */ + each( + callback?: (item: UserInstance, done: (err?: Error) => void) => void + ): void; + each( + params: UserListInstanceEachOptions, + callback?: (item: UserInstance, done: (err?: Error) => void) => void + ): void; + /** + * Retrieve a single target page of UserInstance records from the API. + * + * The request is executed immediately. + * + * @param { string } [targetUrl] - API-generated URL for the requested results page + * @param { function } [callback] - Callback to handle list of records + */ + getPage( + targetUrl: string, + callback?: (error: Error | null, items: UserPage) => any + ): Promise; + /** + * Lists UserInstance records from the API as a list. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { UserListInstanceOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + list( + callback?: (error: Error | null, items: UserInstance[]) => any + ): Promise; + list( + params: UserListInstanceOptions, + callback?: (error: Error | null, items: UserInstance[]) => any + ): Promise; + /** + * Retrieve a single page of UserInstance records from the API. + * + * The request is executed immediately. + * + * If a function is passed as the first argument, it will be used as the callback + * function. + * + * @param { UserListInstancePageOptions } [params] - Options for request + * @param { function } [callback] - Callback to handle list of records + */ + page( + callback?: (error: Error | null, items: UserPage) => any + ): Promise; + page( + params: UserListInstancePageOptions, + callback?: (error: Error | null, items: UserPage) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function UserListInstance( + version: Versionless, + organizationSid: string +): UserListInstance { + if (!isValidPathParam(organizationSid)) { + throw new Error("Parameter 'organizationSid' is not valid."); + } + + const instance = ((id) => instance.get(id)) as UserListInstance; + + instance.get = function get(id): UserContext { + return new UserContextImpl(version, organizationSid, id); + }; + + instance._version = version; + instance._solution = { organizationSid }; + instance._uri = `/${organizationSid}/scim/Users`; + + instance.create = function create( + params: ScimUser, + headers?: any, + callback?: (error: Error | null, items: UserInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + let data: any = {}; + + data = params; + + if (headers === null || headers === undefined) { + headers = {}; + } + + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/scim+json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => + new UserInstance( + operationVersion, + payload, + instance._solution.organizationSid + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + + instance.page = function page( + params?: + | UserListInstancePageOptions + | ((error: Error | null, items: UserPage) => any), + callback?: (error: Error | null, items: UserPage) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + if (params["filter"] !== undefined) data["filter"] = params["filter"]; + + if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; + if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; + + const headers: any = {}; + headers["Accept"] = "application/scim+json"; + + let operationVersion = version, + operationPromise = operationVersion.page({ + uri: instance._uri, + method: "get", + params: data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new UserPage(operationVersion, payload, instance._solution) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + instance.each = instance._version.each; + instance.list = instance._version.list; + + instance.getPage = function getPage( + targetUrl: string, + callback?: (error: Error | null, items: UserPage) => any + ): Promise { + const operationPromise = instance._version._domain.twilio.request({ + method: "get", + uri: targetUrl, + }); + + let pagePromise = operationPromise.then( + (payload) => new UserPage(instance._version, payload, instance._solution) + ); + pagePromise = instance._version.setPromiseCallback(pagePromise, callback); + return pagePromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +export class UserPage extends Page< + Versionless, + UserPayload, + UserResource, + UserInstance +> { + /** + * Initialize the UserPage + * + * @param version - Version of the resource + * @param response - Response from the API + * @param solution - Path solution + */ + constructor( + version: Versionless, + response: Response, + solution: UserSolution + ) { + super(version, response, solution); + } + + /** + * Build an instance of UserInstance + * + * @param payload - Payload response from the API + */ + getInstance(payload: UserResource): UserInstance { + return new UserInstance( + this._version, + payload, + this._solution.organizationSid + ); + } + + [inspect.custom](depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/pricing/v1/messaging/country.ts b/src/rest/pricing/v1/messaging/country.ts index 72cf4eea23..f584a2d0c0 100644 --- a/src/rest/pricing/v1/messaging/country.ts +++ b/src/rest/pricing/v1/messaging/country.ts @@ -21,9 +21,9 @@ const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; export class PricingV1MessagingMessagingCountryInstanceInboundSmsPrices { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } export class PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices { @@ -34,9 +34,9 @@ export class PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices { } export class PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } /** @@ -114,11 +114,15 @@ export class CountryContextImpl implements CountryContext { fetch( callback?: (error: Error | null, item?: CountryInstance) => any ): Promise { + 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( @@ -368,6 +372,7 @@ export function CountryListInstance(version: V1): CountryListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/pricing/v1/phoneNumber/country.ts b/src/rest/pricing/v1/phoneNumber/country.ts index 6d6c45639a..7ba7f8146a 100644 --- a/src/rest/pricing/v1/phoneNumber/country.ts +++ b/src/rest/pricing/v1/phoneNumber/country.ts @@ -21,9 +21,9 @@ const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; export class PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } /** @@ -101,11 +101,15 @@ export class CountryContextImpl implements CountryContext { fetch( callback?: (error: Error | null, item?: CountryInstance) => any ): Promise { + 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( @@ -348,6 +352,7 @@ export function CountryListInstance(version: V1): CountryListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/pricing/v1/voice/country.ts b/src/rest/pricing/v1/voice/country.ts index 0b62639675..090ba7217c 100644 --- a/src/rest/pricing/v1/voice/country.ts +++ b/src/rest/pricing/v1/voice/country.ts @@ -21,16 +21,16 @@ const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; export class PricingV1VoiceVoiceCountryInstanceInboundCallPrices { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } export class PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices { "prefixes"?: Array; - "basePrice"?: number; - "currentPrice"?: number; - "friendlyName"?: string; + "base_price"?: number; + "current_price"?: number; + "friendly_name"?: string; } /** @@ -108,11 +108,15 @@ export class CountryContextImpl implements CountryContext { fetch( callback?: (error: Error | null, item?: CountryInstance) => any ): Promise { + 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( @@ -362,6 +366,7 @@ export function CountryListInstance(version: V1): CountryListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/pricing/v1/voice/number.ts b/src/rest/pricing/v1/voice/number.ts index 6b24f76f2e..0f909ab172 100644 --- a/src/rest/pricing/v1/voice/number.ts +++ b/src/rest/pricing/v1/voice/number.ts @@ -22,17 +22,17 @@ import { isValidPathParam } from "../../../../base/utility"; * The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. If `null`, the Phone Number is not a Twilio number owned by this account. */ export class PricingV1VoiceVoiceNumberInboundCallPrice { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } /** * The OutboundCallPrice record, which includes a list of `origination_prefixes` and the `base_price` and `current_price` for those prefixes. */ export class PricingV1VoiceVoiceNumberOutboundCallPrice { - "basePrice"?: number; - "currentPrice"?: number; + "base_price"?: number; + "current_price"?: number; } export interface NumberContext { @@ -74,11 +74,15 @@ export class NumberContextImpl implements NumberContext { fetch( callback?: (error: Error | null, item?: NumberInstance) => any ): Promise { + 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( diff --git a/src/rest/pricing/v2/country.ts b/src/rest/pricing/v2/country.ts index 8a31b21293..030b87820a 100644 --- a/src/rest/pricing/v2/country.ts +++ b/src/rest/pricing/v2/country.ts @@ -21,17 +21,17 @@ const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; export class PricingV2TrunkingCountryInstanceOriginatingCallPrices { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } export class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { - "originationPrefixes"?: Array; - "destinationPrefixes"?: Array; - "basePrice"?: number; - "currentPrice"?: number; - "friendlyName"?: string; + "origination_prefixes"?: Array; + "destination_prefixes"?: Array; + "base_price"?: number; + "current_price"?: number; + "friendly_name"?: string; } /** @@ -109,11 +109,15 @@ export class CountryContextImpl implements CountryContext { fetch( callback?: (error: Error | null, item?: CountryInstance) => any ): Promise { + 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( @@ -363,6 +367,7 @@ export function CountryListInstance(version: V2): CountryListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/pricing/v2/number.ts b/src/rest/pricing/v2/number.ts index 7670572a1b..9cd37bed3d 100644 --- a/src/rest/pricing/v2/number.ts +++ b/src/rest/pricing/v2/number.ts @@ -19,20 +19,20 @@ const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; export class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { - "originationPrefixes"?: Array; - "destinationPrefixes"?: Array; - "basePrice"?: number; - "currentPrice"?: number; - "friendlyName"?: string; + "origination_prefixes"?: Array; + "destination_prefixes"?: Array; + "base_price"?: number; + "current_price"?: number; + "friendly_name"?: string; } /** * The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. */ export class PricingV2TrunkingNumberOriginatingCallPrice { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } /** @@ -110,6 +110,7 @@ export class NumberContextImpl implements NumberContext { data["OriginationNumber"] = params["originationNumber"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/pricing/v2/voice/country.ts b/src/rest/pricing/v2/voice/country.ts index 19c6394200..421c1cadc7 100644 --- a/src/rest/pricing/v2/voice/country.ts +++ b/src/rest/pricing/v2/voice/country.ts @@ -21,17 +21,17 @@ const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; export class PricingV2TrunkingCountryInstanceOriginatingCallPrices { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } export class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { - "originationPrefixes"?: Array; - "destinationPrefixes"?: Array; - "basePrice"?: number; - "currentPrice"?: number; - "friendlyName"?: string; + "origination_prefixes"?: Array; + "destination_prefixes"?: Array; + "base_price"?: number; + "current_price"?: number; + "friendly_name"?: string; } /** @@ -109,11 +109,15 @@ export class CountryContextImpl implements CountryContext { fetch( callback?: (error: Error | null, item?: CountryInstance) => any ): Promise { + 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( @@ -363,6 +367,7 @@ export function CountryListInstance(version: V2): CountryListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/pricing/v2/voice/number.ts b/src/rest/pricing/v2/voice/number.ts index 546129ecf0..3fa6f46148 100644 --- a/src/rest/pricing/v2/voice/number.ts +++ b/src/rest/pricing/v2/voice/number.ts @@ -22,15 +22,15 @@ import { isValidPathParam } from "../../../../base/utility"; * The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. */ export class PricingV2VoiceVoiceNumberInboundCallPrice { - "basePrice"?: number; - "currentPrice"?: number; - "numberType"?: string; + "base_price"?: number; + "current_price"?: number; + "number_type"?: string; } export class PricingV2VoiceVoiceNumberOutboundCallPrices { - "basePrice"?: number; - "currentPrice"?: number; - "originationPrefixes"?: Array; + "base_price"?: number; + "current_price"?: number; + "origination_prefixes"?: Array; } /** @@ -108,6 +108,7 @@ export class NumberContextImpl implements NumberContext { data["OriginationNumber"] = params["originationNumber"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/proxy/v1/service.ts b/src/rest/proxy/v1/service.ts index 1e4c62a269..48afe5bfda 100644 --- a/src/rest/proxy/v1/service.ts +++ b/src/rest/proxy/v1/service.ts @@ -211,11 +211,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -228,11 +231,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -281,6 +288,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -667,6 +675,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -708,6 +717,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/proxy/v1/service/phoneNumber.ts b/src/rest/proxy/v1/service/phoneNumber.ts index 174e420e24..ef3d7f6cd6 100644 --- a/src/rest/proxy/v1/service/phoneNumber.ts +++ b/src/rest/proxy/v1/service/phoneNumber.ts @@ -154,11 +154,14 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -171,11 +174,15 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { fetch( callback?: (error: Error | null, item?: PhoneNumberInstance) => any ): Promise { + 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( @@ -215,6 +222,7 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -593,6 +601,7 @@ export function PhoneNumberListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -639,6 +648,7 @@ export function PhoneNumberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/proxy/v1/service/session.ts b/src/rest/proxy/v1/service/session.ts index 199e6d5796..8ee0d085c7 100644 --- a/src/rest/proxy/v1/service/session.ts +++ b/src/rest/proxy/v1/service/session.ts @@ -202,11 +202,14 @@ export class SessionContextImpl implements SessionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -219,11 +222,15 @@ export class SessionContextImpl implements SessionContext { fetch( callback?: (error: Error | null, item?: SessionInstance) => any ): Promise { + 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( @@ -265,6 +272,7 @@ export class SessionContextImpl implements SessionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -690,6 +698,7 @@ export function SessionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -736,6 +745,7 @@ export function SessionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/proxy/v1/service/session/interaction.ts b/src/rest/proxy/v1/service/session/interaction.ts index 83b8ec7449..14bd3108c7 100644 --- a/src/rest/proxy/v1/service/session/interaction.ts +++ b/src/rest/proxy/v1/service/session/interaction.ts @@ -146,11 +146,14 @@ export class InteractionContextImpl implements InteractionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -163,11 +166,15 @@ export class InteractionContextImpl implements InteractionContext { fetch( callback?: (error: Error | null, item?: InteractionInstance) => any ): Promise { + 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( @@ -535,6 +542,7 @@ export function InteractionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/proxy/v1/service/session/participant.ts b/src/rest/proxy/v1/service/session/participant.ts index dd4ed916cd..5c1f011b05 100644 --- a/src/rest/proxy/v1/service/session/participant.ts +++ b/src/rest/proxy/v1/service/session/participant.ts @@ -151,11 +151,14 @@ export class ParticipantContextImpl implements ParticipantContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -168,11 +171,15 @@ export class ParticipantContextImpl implements ParticipantContext { fetch( callback?: (error: Error | null, item?: ParticipantInstance) => any ): Promise { + 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( @@ -530,6 +537,7 @@ export function ParticipantListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -577,6 +585,7 @@ export function ParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/proxy/v1/service/session/participant/messageInteraction.ts b/src/rest/proxy/v1/service/session/participant/messageInteraction.ts index 4e74a52b67..eb5268c58a 100644 --- a/src/rest/proxy/v1/service/session/participant/messageInteraction.ts +++ b/src/rest/proxy/v1/service/session/participant/messageInteraction.ts @@ -155,11 +155,15 @@ export class MessageInteractionContextImpl fetch( callback?: (error: Error | null, item?: MessageInteractionInstance) => any ): Promise { + 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( @@ -571,6 +575,7 @@ export function MessageInteractionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -619,6 +624,7 @@ export function MessageInteractionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/proxy/v1/service/shortCode.ts b/src/rest/proxy/v1/service/shortCode.ts index c54577b34c..eb3148e460 100644 --- a/src/rest/proxy/v1/service/shortCode.ts +++ b/src/rest/proxy/v1/service/shortCode.ts @@ -150,11 +150,14 @@ export class ShortCodeContextImpl implements ShortCodeContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class ShortCodeContextImpl implements ShortCodeContext { fetch( callback?: (error: Error | null, item?: ShortCodeInstance) => any ): Promise { + 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( @@ -211,6 +218,7 @@ export class ShortCodeContextImpl implements ShortCodeContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -560,6 +568,7 @@ export function ShortCodeListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -606,6 +615,7 @@ export function ShortCodeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/routes/v2/phoneNumber.ts b/src/rest/routes/v2/phoneNumber.ts index e0f366ccbe..35fdb1f0a4 100644 --- a/src/rest/routes/v2/phoneNumber.ts +++ b/src/rest/routes/v2/phoneNumber.ts @@ -90,11 +90,15 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { fetch( callback?: (error: Error | null, item?: PhoneNumberInstance) => any ): Promise { + 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( @@ -135,6 +139,7 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/routes/v2/sipDomain.ts b/src/rest/routes/v2/sipDomain.ts index f438e59b44..295379a1df 100644 --- a/src/rest/routes/v2/sipDomain.ts +++ b/src/rest/routes/v2/sipDomain.ts @@ -90,11 +90,15 @@ export class SipDomainContextImpl implements SipDomainContext { fetch( callback?: (error: Error | null, item?: SipDomainInstance) => any ): Promise { + 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( @@ -135,6 +139,7 @@ export class SipDomainContextImpl implements SipDomainContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/routes/v2/trunk.ts b/src/rest/routes/v2/trunk.ts index cb74fd4929..77a7014145 100644 --- a/src/rest/routes/v2/trunk.ts +++ b/src/rest/routes/v2/trunk.ts @@ -90,11 +90,15 @@ export class TrunkContextImpl implements TrunkContext { fetch( callback?: (error: Error | null, item?: TrunkInstance) => any ): Promise { + 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( @@ -135,6 +139,7 @@ export class TrunkContextImpl implements TrunkContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/serverless/v1/service.ts b/src/rest/serverless/v1/service.ts index 6326731f87..6c203d3499 100644 --- a/src/rest/serverless/v1/service.ts +++ b/src/rest/serverless/v1/service.ts @@ -194,11 +194,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -211,11 +214,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -254,6 +261,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -631,6 +639,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -672,6 +681,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/asset.ts b/src/rest/serverless/v1/service/asset.ts index dfd6eb967f..eca9fb5bd6 100644 --- a/src/rest/serverless/v1/service/asset.ts +++ b/src/rest/serverless/v1/service/asset.ts @@ -155,11 +155,14 @@ export class AssetContextImpl implements AssetContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -172,11 +175,15 @@ export class AssetContextImpl implements AssetContext { fetch( callback?: (error: Error | null, item?: AssetInstance) => any ): Promise { + 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( @@ -217,6 +224,7 @@ export class AssetContextImpl implements AssetContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -555,6 +563,7 @@ export function AssetListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -601,6 +610,7 @@ export function AssetListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/asset/assetVersion.ts b/src/rest/serverless/v1/service/asset/assetVersion.ts index 3777330266..620b32f24b 100644 --- a/src/rest/serverless/v1/service/asset/assetVersion.ts +++ b/src/rest/serverless/v1/service/asset/assetVersion.ts @@ -112,11 +112,15 @@ export class AssetVersionContextImpl implements AssetVersionContext { fetch( callback?: (error: Error | null, item?: AssetVersionInstance) => any ): Promise { + 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( @@ -400,6 +404,7 @@ export function AssetVersionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/build.ts b/src/rest/serverless/v1/service/build.ts index 548d93fb70..652ada9dc3 100644 --- a/src/rest/serverless/v1/service/build.ts +++ b/src/rest/serverless/v1/service/build.ts @@ -150,11 +150,14 @@ export class BuildContextImpl implements BuildContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class BuildContextImpl implements BuildContext { fetch( callback?: (error: Error | null, item?: BuildInstance) => any ): Promise { + 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( @@ -521,6 +528,7 @@ export function BuildListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -567,6 +575,7 @@ export function BuildListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/build/buildStatus.ts b/src/rest/serverless/v1/service/build/buildStatus.ts index a5d87c89ac..b7151d9aef 100644 --- a/src/rest/serverless/v1/service/build/buildStatus.ts +++ b/src/rest/serverless/v1/service/build/buildStatus.ts @@ -64,11 +64,15 @@ export class BuildStatusContextImpl implements BuildStatusContext { fetch( callback?: (error: Error | null, item?: BuildStatusInstance) => any ): Promise { + 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( diff --git a/src/rest/serverless/v1/service/environment.ts b/src/rest/serverless/v1/service/environment.ts index fcea89f8d2..39abb9d5a8 100644 --- a/src/rest/serverless/v1/service/environment.ts +++ b/src/rest/serverless/v1/service/environment.ts @@ -164,11 +164,14 @@ export class EnvironmentContextImpl implements EnvironmentContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -181,11 +184,15 @@ export class EnvironmentContextImpl implements EnvironmentContext { fetch( callback?: (error: Error | null, item?: EnvironmentInstance) => any ): Promise { + 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( @@ -530,6 +537,7 @@ export function EnvironmentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -576,6 +584,7 @@ export function EnvironmentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/environment/deployment.ts b/src/rest/serverless/v1/service/environment/deployment.ts index eed9503b72..43138eae8e 100644 --- a/src/rest/serverless/v1/service/environment/deployment.ts +++ b/src/rest/serverless/v1/service/environment/deployment.ts @@ -26,6 +26,8 @@ import { isValidPathParam } from "../../../../../base/utility"; export interface DeploymentListInstanceCreateOptions { /** The SID of the Build for the Deployment. */ buildSid?: string; + /** Whether the Deployment is a plugin. */ + isPlugin?: boolean; } /** * Options to pass to each @@ -117,11 +119,15 @@ export class DeploymentContextImpl implements DeploymentContext { fetch( callback?: (error: Error | null, item?: DeploymentInstance) => any ): Promise { + 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( @@ -426,9 +432,12 @@ export function DeploymentListInstance( let data: any = {}; if (params["buildSid"] !== undefined) data["BuildSid"] = params["buildSid"]; + if (params["isPlugin"] !== undefined) + data["IsPlugin"] = serialize.bool(params["isPlugin"]); const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -476,6 +485,7 @@ export function DeploymentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/environment/log.ts b/src/rest/serverless/v1/service/environment/log.ts index a2329877d4..ab5b295c1f 100644 --- a/src/rest/serverless/v1/service/environment/log.ts +++ b/src/rest/serverless/v1/service/environment/log.ts @@ -130,11 +130,15 @@ export class LogContextImpl implements LogContext { fetch( callback?: (error: Error | null, item?: LogInstance) => any ): Promise { + 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( @@ -452,6 +456,7 @@ export function LogListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/environment/variable.ts b/src/rest/serverless/v1/service/environment/variable.ts index 1d2b3ad2fc..cb61f0d0bc 100644 --- a/src/rest/serverless/v1/service/environment/variable.ts +++ b/src/rest/serverless/v1/service/environment/variable.ts @@ -163,11 +163,14 @@ export class VariableContextImpl implements VariableContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -180,11 +183,15 @@ export class VariableContextImpl implements VariableContext { fetch( callback?: (error: Error | null, item?: VariableInstance) => any ): Promise { + 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( @@ -225,6 +232,7 @@ export class VariableContextImpl implements VariableContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -585,6 +593,7 @@ export function VariableListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -632,6 +641,7 @@ export function VariableListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/function.ts b/src/rest/serverless/v1/service/function.ts index ac795739bd..e5b8c27e06 100644 --- a/src/rest/serverless/v1/service/function.ts +++ b/src/rest/serverless/v1/service/function.ts @@ -155,11 +155,14 @@ export class FunctionContextImpl implements FunctionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -172,11 +175,15 @@ export class FunctionContextImpl implements FunctionContext { fetch( callback?: (error: Error | null, item?: FunctionInstance) => any ): Promise { + 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( @@ -217,6 +224,7 @@ export class FunctionContextImpl implements FunctionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -555,6 +563,7 @@ export function FunctionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -601,6 +610,7 @@ export function FunctionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/function/functionVersion.ts b/src/rest/serverless/v1/service/function/functionVersion.ts index 4698c0ce44..19adb040a2 100644 --- a/src/rest/serverless/v1/service/function/functionVersion.ts +++ b/src/rest/serverless/v1/service/function/functionVersion.ts @@ -132,11 +132,15 @@ export class FunctionVersionContextImpl implements FunctionVersionContext { fetch( callback?: (error: Error | null, item?: FunctionVersionInstance) => any ): Promise { + 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( @@ -442,6 +446,7 @@ export function FunctionVersionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/serverless/v1/service/function/functionVersion/functionVersionContent.ts b/src/rest/serverless/v1/service/function/functionVersion/functionVersionContent.ts index 8b847cda7f..c80e21f93a 100644 --- a/src/rest/serverless/v1/service/function/functionVersion/functionVersionContent.ts +++ b/src/rest/serverless/v1/service/function/functionVersion/functionVersionContent.ts @@ -80,11 +80,15 @@ export class FunctionVersionContentContextImpl item?: FunctionVersionContentInstance ) => any ): Promise { + 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( diff --git a/src/rest/studio/v1/flow.ts b/src/rest/studio/v1/flow.ts index cbadb7c305..f66328a625 100644 --- a/src/rest/studio/v1/flow.ts +++ b/src/rest/studio/v1/flow.ts @@ -130,11 +130,14 @@ export class FlowContextImpl implements FlowContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -147,11 +150,15 @@ export class FlowContextImpl implements FlowContext { fetch( callback?: (error: Error | null, item?: FlowInstance) => any ): Promise { + 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( @@ -436,6 +443,7 @@ export function FlowListInstance(version: V1): FlowListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v1/flow/engagement.ts b/src/rest/studio/v1/flow/engagement.ts index 3d22db0293..26e1d6ceaa 100644 --- a/src/rest/studio/v1/flow/engagement.ts +++ b/src/rest/studio/v1/flow/engagement.ts @@ -154,11 +154,14 @@ export class EngagementContextImpl implements EngagementContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -171,11 +174,15 @@ export class EngagementContextImpl implements EngagementContext { fetch( callback?: (error: Error | null, item?: EngagementInstance) => any ): Promise { + 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( @@ -516,6 +523,7 @@ export function EngagementListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -562,6 +570,7 @@ export function EngagementListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v1/flow/engagement/engagementContext.ts b/src/rest/studio/v1/flow/engagement/engagementContext.ts index 315ed90fe1..f844eeb149 100644 --- a/src/rest/studio/v1/flow/engagement/engagementContext.ts +++ b/src/rest/studio/v1/flow/engagement/engagementContext.ts @@ -62,11 +62,15 @@ export class EngagementContextContextImpl implements EngagementContextContext { fetch( callback?: (error: Error | null, item?: EngagementContextInstance) => any ): Promise { + 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( diff --git a/src/rest/studio/v1/flow/engagement/step.ts b/src/rest/studio/v1/flow/engagement/step.ts index d9a09e30ca..0c34aaaeb4 100644 --- a/src/rest/studio/v1/flow/engagement/step.ts +++ b/src/rest/studio/v1/flow/engagement/step.ts @@ -127,11 +127,15 @@ export class StepContextImpl implements StepContext { fetch( callback?: (error: Error | null, item?: StepInstance) => any ): Promise { + 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( @@ -453,6 +457,7 @@ export function StepListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v1/flow/engagement/step/stepContext.ts b/src/rest/studio/v1/flow/engagement/step/stepContext.ts index 811401018d..eea0661210 100644 --- a/src/rest/studio/v1/flow/engagement/step/stepContext.ts +++ b/src/rest/studio/v1/flow/engagement/step/stepContext.ts @@ -72,11 +72,15 @@ export class StepContextContextImpl implements StepContextContext { fetch( callback?: (error: Error | null, item?: StepContextInstance) => any ): Promise { + 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( diff --git a/src/rest/studio/v1/flow/execution.ts b/src/rest/studio/v1/flow/execution.ts index 3f3c31d8ca..cdb9510acf 100644 --- a/src/rest/studio/v1/flow/execution.ts +++ b/src/rest/studio/v1/flow/execution.ts @@ -187,11 +187,14 @@ export class ExecutionContextImpl implements ExecutionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -204,11 +207,15 @@ export class ExecutionContextImpl implements ExecutionContext { fetch( callback?: (error: Error | null, item?: ExecutionInstance) => any ): Promise { + 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( @@ -246,6 +253,7 @@ export class ExecutionContextImpl implements ExecutionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -614,6 +622,7 @@ export function ExecutionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -668,6 +677,7 @@ export function ExecutionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v1/flow/execution/executionContext.ts b/src/rest/studio/v1/flow/execution/executionContext.ts index 481b063b94..4960bc378d 100644 --- a/src/rest/studio/v1/flow/execution/executionContext.ts +++ b/src/rest/studio/v1/flow/execution/executionContext.ts @@ -62,11 +62,15 @@ export class ExecutionContextContextImpl implements ExecutionContextContext { fetch( callback?: (error: Error | null, item?: ExecutionContextInstance) => any ): Promise { + 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( diff --git a/src/rest/studio/v1/flow/execution/executionStep.ts b/src/rest/studio/v1/flow/execution/executionStep.ts index dd816041d6..9e963849b7 100644 --- a/src/rest/studio/v1/flow/execution/executionStep.ts +++ b/src/rest/studio/v1/flow/execution/executionStep.ts @@ -127,11 +127,15 @@ export class ExecutionStepContextImpl implements ExecutionStepContext { fetch( callback?: (error: Error | null, item?: ExecutionStepInstance) => any ): Promise { + 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( @@ -459,6 +463,7 @@ export function ExecutionStepListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v1/flow/execution/executionStep/executionStepContext.ts b/src/rest/studio/v1/flow/execution/executionStep/executionStepContext.ts index d9da24a9c0..b8f9f4556a 100644 --- a/src/rest/studio/v1/flow/execution/executionStep/executionStepContext.ts +++ b/src/rest/studio/v1/flow/execution/executionStep/executionStepContext.ts @@ -74,11 +74,15 @@ export class ExecutionStepContextContextImpl fetch( callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any ): Promise { + 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( diff --git a/src/rest/studio/v2/flow.ts b/src/rest/studio/v2/flow.ts index e37643bff8..427c5a3e89 100644 --- a/src/rest/studio/v2/flow.ts +++ b/src/rest/studio/v2/flow.ts @@ -180,11 +180,14 @@ export class FlowContextImpl implements FlowContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -197,11 +200,15 @@ export class FlowContextImpl implements FlowContext { fetch( callback?: (error: Error | null, item?: FlowInstance) => any ): Promise { + 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( @@ -240,6 +247,7 @@ export class FlowContextImpl implements FlowContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -625,6 +633,7 @@ export function FlowListInstance(version: V2): FlowListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -666,6 +675,7 @@ export function FlowListInstance(version: V2): FlowListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v2/flow/execution.ts b/src/rest/studio/v2/flow/execution.ts index 87f75940cd..b8f666ef47 100644 --- a/src/rest/studio/v2/flow/execution.ts +++ b/src/rest/studio/v2/flow/execution.ts @@ -187,11 +187,14 @@ export class ExecutionContextImpl implements ExecutionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -204,11 +207,15 @@ export class ExecutionContextImpl implements ExecutionContext { fetch( callback?: (error: Error | null, item?: ExecutionInstance) => any ): Promise { + 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( @@ -246,6 +253,7 @@ export class ExecutionContextImpl implements ExecutionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -607,6 +615,7 @@ export function ExecutionListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -661,6 +670,7 @@ export function ExecutionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v2/flow/execution/executionContext.ts b/src/rest/studio/v2/flow/execution/executionContext.ts index 1a575f9b28..51ff8f3e46 100644 --- a/src/rest/studio/v2/flow/execution/executionContext.ts +++ b/src/rest/studio/v2/flow/execution/executionContext.ts @@ -62,11 +62,15 @@ export class ExecutionContextContextImpl implements ExecutionContextContext { fetch( callback?: (error: Error | null, item?: ExecutionContextInstance) => any ): Promise { + 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( diff --git a/src/rest/studio/v2/flow/execution/executionStep.ts b/src/rest/studio/v2/flow/execution/executionStep.ts index 5c724d854b..6a4f429269 100644 --- a/src/rest/studio/v2/flow/execution/executionStep.ts +++ b/src/rest/studio/v2/flow/execution/executionStep.ts @@ -127,11 +127,15 @@ export class ExecutionStepContextImpl implements ExecutionStepContext { fetch( callback?: (error: Error | null, item?: ExecutionStepInstance) => any ): Promise { + 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( @@ -459,6 +463,7 @@ export function ExecutionStepListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v2/flow/execution/executionStep/executionStepContext.ts b/src/rest/studio/v2/flow/execution/executionStep/executionStepContext.ts index 81d7468008..d6688ea5eb 100644 --- a/src/rest/studio/v2/flow/execution/executionStep/executionStepContext.ts +++ b/src/rest/studio/v2/flow/execution/executionStep/executionStepContext.ts @@ -74,11 +74,15 @@ export class ExecutionStepContextContextImpl fetch( callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any ): Promise { + 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( diff --git a/src/rest/studio/v2/flow/flowRevision.ts b/src/rest/studio/v2/flow/flowRevision.ts index 4acfb6f8da..c0ab9bc732 100644 --- a/src/rest/studio/v2/flow/flowRevision.ts +++ b/src/rest/studio/v2/flow/flowRevision.ts @@ -102,11 +102,15 @@ export class FlowRevisionContextImpl implements FlowRevisionContext { fetch( callback?: (error: Error | null, item?: FlowRevisionInstance) => any ): Promise { + 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( @@ -410,6 +414,7 @@ export function FlowRevisionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/studio/v2/flow/flowTestUser.ts b/src/rest/studio/v2/flow/flowTestUser.ts index f2cabc7e5f..8157aef108 100644 --- a/src/rest/studio/v2/flow/flowTestUser.ts +++ b/src/rest/studio/v2/flow/flowTestUser.ts @@ -78,11 +78,15 @@ export class FlowTestUserContextImpl implements FlowTestUserContext { fetch( callback?: (error: Error | null, item?: FlowTestUserInstance) => any ): Promise { + 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( @@ -119,6 +123,7 @@ export class FlowTestUserContextImpl implements FlowTestUserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/studio/v2/flowValidate.ts b/src/rest/studio/v2/flowValidate.ts index aa8ff55f95..930e835f93 100644 --- a/src/rest/studio/v2/flowValidate.ts +++ b/src/rest/studio/v2/flowValidate.ts @@ -105,6 +105,7 @@ export function FlowValidateListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.update({ diff --git a/src/rest/supersim/v1/esimProfile.ts b/src/rest/supersim/v1/esimProfile.ts index 4c0ddbaf8e..914cca8b0b 100644 --- a/src/rest/supersim/v1/esimProfile.ts +++ b/src/rest/supersim/v1/esimProfile.ts @@ -134,11 +134,15 @@ export class EsimProfileContextImpl implements EsimProfileContext { fetch( callback?: (error: Error | null, item?: EsimProfileInstance) => any ): Promise { + 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( @@ -467,6 +471,7 @@ export function EsimProfileListInstance(version: V1): EsimProfileListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -511,6 +516,7 @@ export function EsimProfileListInstance(version: V1): EsimProfileListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/fleet.ts b/src/rest/supersim/v1/fleet.ts index 60d1ac262f..10b8ed153b 100644 --- a/src/rest/supersim/v1/fleet.ts +++ b/src/rest/supersim/v1/fleet.ts @@ -169,11 +169,15 @@ export class FleetContextImpl implements FleetContext { fetch( callback?: (error: Error | null, item?: FleetInstance) => any ): Promise { + 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( @@ -220,6 +224,7 @@ export class FleetContextImpl implements FleetContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -588,6 +593,7 @@ export function FleetListInstance(version: V1): FleetListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -631,6 +637,7 @@ export function FleetListInstance(version: V1): FleetListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/ipCommand.ts b/src/rest/supersim/v1/ipCommand.ts index 73511b42e4..a0ee693093 100644 --- a/src/rest/supersim/v1/ipCommand.ts +++ b/src/rest/supersim/v1/ipCommand.ts @@ -142,11 +142,15 @@ export class IpCommandContextImpl implements IpCommandContext { fetch( callback?: (error: Error | null, item?: IpCommandInstance) => any ): Promise { + 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( @@ -459,6 +463,7 @@ export function IpCommandListInstance(version: V1): IpCommandListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -505,6 +510,7 @@ export function IpCommandListInstance(version: V1): IpCommandListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/network.ts b/src/rest/supersim/v1/network.ts index 96867973ad..8a051fd0bd 100644 --- a/src/rest/supersim/v1/network.ts +++ b/src/rest/supersim/v1/network.ts @@ -113,11 +113,15 @@ export class NetworkContextImpl implements NetworkContext { fetch( callback?: (error: Error | null, item?: NetworkInstance) => any ): Promise { + 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( @@ -355,6 +359,7 @@ export function NetworkListInstance(version: V1): NetworkListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/networkAccessProfile.ts b/src/rest/supersim/v1/networkAccessProfile.ts index 27b3391ffe..560b713f1c 100644 --- a/src/rest/supersim/v1/networkAccessProfile.ts +++ b/src/rest/supersim/v1/networkAccessProfile.ts @@ -155,11 +155,15 @@ export class NetworkAccessProfileContextImpl fetch( callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any ): Promise { + 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( @@ -198,6 +202,7 @@ export class NetworkAccessProfileContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -534,6 +539,7 @@ export function NetworkAccessProfileListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -575,6 +581,7 @@ export function NetworkAccessProfileListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.ts b/src/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.ts index 9d0e3e5cc0..96b9e6598b 100644 --- a/src/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.ts +++ b/src/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.ts @@ -130,11 +130,14 @@ export class NetworkAccessProfileNetworkContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -150,11 +153,15 @@ export class NetworkAccessProfileNetworkContextImpl item?: NetworkAccessProfileNetworkInstance ) => any ): Promise { + 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( @@ -476,6 +483,7 @@ export function NetworkAccessProfileNetworkListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -525,6 +533,7 @@ export function NetworkAccessProfileNetworkListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/settingsUpdate.ts b/src/rest/supersim/v1/settingsUpdate.ts index f1be99f731..c4e48421b3 100644 --- a/src/rest/supersim/v1/settingsUpdate.ts +++ b/src/rest/supersim/v1/settingsUpdate.ts @@ -198,6 +198,7 @@ export function SettingsUpdateListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/sim.ts b/src/rest/supersim/v1/sim.ts index 388c24c8bb..92d2cfc6bc 100644 --- a/src/rest/supersim/v1/sim.ts +++ b/src/rest/supersim/v1/sim.ts @@ -189,11 +189,15 @@ export class SimContextImpl implements SimContext { fetch( callback?: (error: Error | null, item?: SimInstance) => any ): Promise { + 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( @@ -236,6 +240,7 @@ export class SimContextImpl implements SimContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -570,6 +575,7 @@ export function SimListInstance(version: V1): SimListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -614,6 +620,7 @@ export function SimListInstance(version: V1): SimListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/sim/billingPeriod.ts b/src/rest/supersim/v1/sim/billingPeriod.ts index 8373ef4cae..269af0a55e 100644 --- a/src/rest/supersim/v1/sim/billingPeriod.ts +++ b/src/rest/supersim/v1/sim/billingPeriod.ts @@ -184,6 +184,7 @@ export function BillingPeriodListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/sim/simIpAddress.ts b/src/rest/supersim/v1/sim/simIpAddress.ts index abbd8b11b2..836d2cbabb 100644 --- a/src/rest/supersim/v1/sim/simIpAddress.ts +++ b/src/rest/supersim/v1/sim/simIpAddress.ts @@ -178,6 +178,7 @@ export function SimIpAddressListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/smsCommand.ts b/src/rest/supersim/v1/smsCommand.ts index 5e1c07a14b..86269f6e52 100644 --- a/src/rest/supersim/v1/smsCommand.ts +++ b/src/rest/supersim/v1/smsCommand.ts @@ -135,11 +135,15 @@ export class SmsCommandContextImpl implements SmsCommandContext { fetch( callback?: (error: Error | null, item?: SmsCommandInstance) => any ): Promise { + 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( @@ -423,6 +427,7 @@ export function SmsCommandListInstance(version: V1): SmsCommandListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -468,6 +473,7 @@ export function SmsCommandListInstance(version: V1): SmsCommandListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/supersim/v1/usageRecord.ts b/src/rest/supersim/v1/usageRecord.ts index 1bc27fdbd4..8f11e0b81b 100644 --- a/src/rest/supersim/v1/usageRecord.ts +++ b/src/rest/supersim/v1/usageRecord.ts @@ -231,6 +231,7 @@ export function UsageRecordListInstance(version: V1): UsageRecordListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service.ts b/src/rest/sync/v1/service.ts index 2f5b79109b..ac9cf5a8ec 100644 --- a/src/rest/sync/v1/service.ts +++ b/src/rest/sync/v1/service.ts @@ -209,11 +209,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -226,11 +229,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -284,6 +291,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -703,6 +711,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -744,6 +753,7 @@ export function ServiceListInstance(version: V1): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/document.ts b/src/rest/sync/v1/service/document.ts index b94b5d4371..a2dbd94fa3 100644 --- a/src/rest/sync/v1/service/document.ts +++ b/src/rest/sync/v1/service/document.ts @@ -173,11 +173,14 @@ export class DocumentContextImpl implements DocumentContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -190,11 +193,15 @@ export class DocumentContextImpl implements DocumentContext { fetch( callback?: (error: Error | null, item?: DocumentInstance) => any ): Promise { + 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( @@ -235,6 +242,7 @@ export class DocumentContextImpl implements DocumentContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -625,6 +633,7 @@ export function DocumentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -671,6 +680,7 @@ export function DocumentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/document/documentPermission.ts b/src/rest/sync/v1/service/document/documentPermission.ts index a24f08206e..c8393f59da 100644 --- a/src/rest/sync/v1/service/document/documentPermission.ts +++ b/src/rest/sync/v1/service/document/documentPermission.ts @@ -150,11 +150,14 @@ export class DocumentPermissionContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class DocumentPermissionContextImpl fetch( callback?: (error: Error | null, item?: DocumentPermissionInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class DocumentPermissionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -565,6 +573,7 @@ export function DocumentPermissionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncList.ts b/src/rest/sync/v1/service/syncList.ts index c669ab4e4a..a0c0f1c0e3 100644 --- a/src/rest/sync/v1/service/syncList.ts +++ b/src/rest/sync/v1/service/syncList.ts @@ -185,11 +185,14 @@ export class SyncListContextImpl implements SyncListContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -202,11 +205,15 @@ export class SyncListContextImpl implements SyncListContext { fetch( callback?: (error: Error | null, item?: SyncListInstance) => any ): Promise { + 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( @@ -247,6 +254,7 @@ export class SyncListContextImpl implements SyncListContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -635,6 +643,7 @@ export function SyncListListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -681,6 +690,7 @@ export function SyncListListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncList/syncListItem.ts b/src/rest/sync/v1/service/syncList/syncListItem.ts index 33257a563b..9cefc2fbec 100644 --- a/src/rest/sync/v1/service/syncList/syncListItem.ts +++ b/src/rest/sync/v1/service/syncList/syncListItem.ts @@ -250,11 +250,15 @@ export class SyncListItemContextImpl implements SyncListItemContext { fetch( callback?: (error: Error | null, item?: SyncListItemInstance) => any ): Promise { + 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( @@ -299,6 +303,7 @@ export class SyncListItemContextImpl implements SyncListItemContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -690,6 +695,7 @@ export function SyncListItemListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -740,6 +746,7 @@ export function SyncListItemListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncList/syncListPermission.ts b/src/rest/sync/v1/service/syncList/syncListPermission.ts index 1fa81fb507..8888146518 100644 --- a/src/rest/sync/v1/service/syncList/syncListPermission.ts +++ b/src/rest/sync/v1/service/syncList/syncListPermission.ts @@ -150,11 +150,14 @@ export class SyncListPermissionContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class SyncListPermissionContextImpl fetch( callback?: (error: Error | null, item?: SyncListPermissionInstance) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class SyncListPermissionContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -565,6 +573,7 @@ export function SyncListPermissionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncMap.ts b/src/rest/sync/v1/service/syncMap.ts index 763069019b..90c825c5ba 100644 --- a/src/rest/sync/v1/service/syncMap.ts +++ b/src/rest/sync/v1/service/syncMap.ts @@ -185,11 +185,14 @@ export class SyncMapContextImpl implements SyncMapContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -202,11 +205,15 @@ export class SyncMapContextImpl implements SyncMapContext { fetch( callback?: (error: Error | null, item?: SyncMapInstance) => any ): Promise { + 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( @@ -247,6 +254,7 @@ export class SyncMapContextImpl implements SyncMapContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -635,6 +643,7 @@ export function SyncMapListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -681,6 +690,7 @@ export function SyncMapListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncMap/syncMapItem.ts b/src/rest/sync/v1/service/syncMap/syncMapItem.ts index 5a798c90ed..8339013194 100644 --- a/src/rest/sync/v1/service/syncMap/syncMapItem.ts +++ b/src/rest/sync/v1/service/syncMap/syncMapItem.ts @@ -252,11 +252,15 @@ export class SyncMapItemContextImpl implements SyncMapItemContext { fetch( callback?: (error: Error | null, item?: SyncMapItemInstance) => any ): Promise { + 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( @@ -301,6 +305,7 @@ export class SyncMapItemContextImpl implements SyncMapItemContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -698,6 +703,7 @@ export function SyncMapItemListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -748,6 +754,7 @@ export function SyncMapItemListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncMap/syncMapPermission.ts b/src/rest/sync/v1/service/syncMap/syncMapPermission.ts index 4e671a0f7f..1e6b314cc7 100644 --- a/src/rest/sync/v1/service/syncMap/syncMapPermission.ts +++ b/src/rest/sync/v1/service/syncMap/syncMapPermission.ts @@ -148,11 +148,14 @@ export class SyncMapPermissionContextImpl implements SyncMapPermissionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class SyncMapPermissionContextImpl implements SyncMapPermissionContext { fetch( callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any ): Promise { + 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( @@ -220,6 +227,7 @@ export class SyncMapPermissionContextImpl implements SyncMapPermissionContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -563,6 +571,7 @@ export function SyncMapPermissionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncStream.ts b/src/rest/sync/v1/service/syncStream.ts index ceff0cba24..df1db68d50 100644 --- a/src/rest/sync/v1/service/syncStream.ts +++ b/src/rest/sync/v1/service/syncStream.ts @@ -167,11 +167,14 @@ export class SyncStreamContextImpl implements SyncStreamContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -184,11 +187,15 @@ export class SyncStreamContextImpl implements SyncStreamContext { fetch( callback?: (error: Error | null, item?: SyncStreamInstance) => any ): Promise { + 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( @@ -227,6 +234,7 @@ export class SyncStreamContextImpl implements SyncStreamContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -599,6 +607,7 @@ export function SyncStreamListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -645,6 +654,7 @@ export function SyncStreamListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/sync/v1/service/syncStream/streamMessage.ts b/src/rest/sync/v1/service/syncStream/streamMessage.ts index bcd5764cd5..cf1963859e 100644 --- a/src/rest/sync/v1/service/syncStream/streamMessage.ts +++ b/src/rest/sync/v1/service/syncStream/streamMessage.ts @@ -93,6 +93,7 @@ export function StreamMessageListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/taskrouter/v1/workspace.ts b/src/rest/taskrouter/v1/workspace.ts index eb72ddaeb1..4ededb2d7e 100644 --- a/src/rest/taskrouter/v1/workspace.ts +++ b/src/rest/taskrouter/v1/workspace.ts @@ -279,11 +279,14 @@ export class WorkspaceContextImpl implements WorkspaceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -296,11 +299,15 @@ export class WorkspaceContextImpl implements WorkspaceContext { fetch( callback?: (error: Error | null, item?: WorkspaceInstance) => any ): Promise { + 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( @@ -347,6 +354,7 @@ export class WorkspaceContextImpl implements WorkspaceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -794,6 +802,7 @@ export function WorkspaceListInstance(version: V1): WorkspaceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -837,6 +846,7 @@ export function WorkspaceListInstance(version: V1): WorkspaceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/activity.ts b/src/rest/taskrouter/v1/workspace/activity.ts index fb3c023653..3899240e4a 100644 --- a/src/rest/taskrouter/v1/workspace/activity.ts +++ b/src/rest/taskrouter/v1/workspace/activity.ts @@ -163,11 +163,14 @@ export class ActivityContextImpl implements ActivityContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -180,11 +183,15 @@ export class ActivityContextImpl implements ActivityContext { fetch( callback?: (error: Error | null, item?: ActivityInstance) => any ): Promise { + 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( @@ -224,6 +231,7 @@ export class ActivityContextImpl implements ActivityContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -571,6 +579,7 @@ export function ActivityListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -621,6 +630,7 @@ export function ActivityListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/event.ts b/src/rest/taskrouter/v1/workspace/event.ts index 707f3f0189..ff60b27167 100644 --- a/src/rest/taskrouter/v1/workspace/event.ts +++ b/src/rest/taskrouter/v1/workspace/event.ts @@ -166,11 +166,15 @@ export class EventContextImpl implements EventContext { fetch( callback?: (error: Error | null, item?: EventInstance) => any ): Promise { + 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( @@ -530,6 +534,7 @@ export function EventListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/task.ts b/src/rest/taskrouter/v1/workspace/task.ts index 50542db8dd..23df30df6f 100644 --- a/src/rest/taskrouter/v1/workspace/task.ts +++ b/src/rest/taskrouter/v1/workspace/task.ts @@ -53,7 +53,7 @@ export interface TaskContextUpdateOptions { priority?: number; /** When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel\\\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; - /** The task\\\'s new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can\\\'t be in the future. */ + /** The task\\\'s new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can\\\'t be in the future or before the year of 1900. */ virtualStartTime?: Date; } @@ -71,7 +71,7 @@ export interface TaskListInstanceCreateOptions { workflowSid?: string; /** A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow\\\'s `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. */ attributes?: string; - /** The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can\\\'t be in the future. */ + /** The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can\\\'t be in the future or before the year of 1900. */ virtualStartTime?: Date; /** A SID of a Worker, Queue, or Workflow to route a Task to */ routingTarget?: string; @@ -316,11 +316,15 @@ export class TaskContextImpl implements TaskContext { fetch( callback?: (error: Error | null, item?: TaskInstance) => any ): Promise { + 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( @@ -370,6 +374,7 @@ export class TaskContextImpl implements TaskContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -875,6 +880,7 @@ export function TaskListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -942,6 +948,7 @@ export function TaskListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/task/reservation.ts b/src/rest/taskrouter/v1/workspace/task/reservation.ts index 82097e450f..44d19f1660 100644 --- a/src/rest/taskrouter/v1/workspace/task/reservation.ts +++ b/src/rest/taskrouter/v1/workspace/task/reservation.ts @@ -287,11 +287,15 @@ export class ReservationContextImpl implements ReservationContext { fetch( callback?: (error: Error | null, item?: ReservationInstance) => any ): Promise { + 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( @@ -450,6 +454,7 @@ export class ReservationContextImpl implements ReservationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -798,6 +803,7 @@ export function ReservationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/taskChannel.ts b/src/rest/taskrouter/v1/workspace/taskChannel.ts index f942473f53..865816a9de 100644 --- a/src/rest/taskrouter/v1/workspace/taskChannel.ts +++ b/src/rest/taskrouter/v1/workspace/taskChannel.ts @@ -155,11 +155,14 @@ export class TaskChannelContextImpl implements TaskChannelContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -172,11 +175,15 @@ export class TaskChannelContextImpl implements TaskChannelContext { fetch( callback?: (error: Error | null, item?: TaskChannelInstance) => any ): Promise { + 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( @@ -220,6 +227,7 @@ export class TaskChannelContextImpl implements TaskChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -585,6 +593,7 @@ export function TaskChannelListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -631,6 +640,7 @@ export function TaskChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/taskQueue.ts b/src/rest/taskrouter/v1/workspace/taskQueue.ts index 94e5811288..fdb9224f40 100644 --- a/src/rest/taskrouter/v1/workspace/taskQueue.ts +++ b/src/rest/taskrouter/v1/workspace/taskQueue.ts @@ -241,11 +241,14 @@ export class TaskQueueContextImpl implements TaskQueueContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -258,11 +261,15 @@ export class TaskQueueContextImpl implements TaskQueueContext { fetch( callback?: (error: Error | null, item?: TaskQueueInstance) => any ): Promise { + 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( @@ -312,6 +319,7 @@ export class TaskQueueContextImpl implements TaskQueueContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -760,6 +768,7 @@ export function TaskQueueListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -813,6 +822,7 @@ export function TaskQueueListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueBulkRealTimeStatistics.ts b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueBulkRealTimeStatistics.ts index 38c833e8e8..62e6d8664b 100644 --- a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueBulkRealTimeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueBulkRealTimeStatistics.ts @@ -52,12 +52,14 @@ export interface TaskQueueBulkRealTimeStatisticsListInstance { * Create a TaskQueueBulkRealTimeStatisticsInstance * * @param params - Body for request + * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueBulkRealTimeStatisticsInstance */ create( params: object, + headers?: any, callback?: ( error: Error | null, item?: TaskQueueBulkRealTimeStatisticsInstance @@ -92,6 +94,7 @@ export function TaskQueueBulkRealTimeStatisticsListInstance( error: Error | null, items: TaskQueueBulkRealTimeStatisticsInstance ) => any), + headers?: any, callback?: ( error: Error | null, items: TaskQueueBulkRealTimeStatisticsInstance @@ -108,8 +111,12 @@ export function TaskQueueBulkRealTimeStatisticsListInstance( data = params; - const headers: any = {}; + if (headers === null || headers === undefined) { + headers = {}; + } + headers["Content-Type"] = "application/json"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.ts b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.ts index dc72852862..d40c146384 100644 --- a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.ts @@ -131,6 +131,7 @@ export class TaskQueueCumulativeStatisticsContextImpl data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.ts b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.ts index a987313885..83b3514aca 100644 --- a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.ts @@ -116,6 +116,7 @@ export class TaskQueueRealTimeStatisticsContextImpl data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueStatistics.ts b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueStatistics.ts index 7870a9ccc2..aa14236f34 100644 --- a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueueStatistics.ts @@ -119,6 +119,7 @@ export class TaskQueueStatisticsContextImpl data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.ts b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.ts index 632ccb51da..6085c9fb42 100644 --- a/src/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.ts @@ -238,6 +238,7 @@ export function TaskQueuesStatisticsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/worker.ts b/src/rest/taskrouter/v1/workspace/worker.ts index 497de0d8ea..b8eb398d57 100644 --- a/src/rest/taskrouter/v1/workspace/worker.ts +++ b/src/rest/taskrouter/v1/workspace/worker.ts @@ -311,11 +311,15 @@ export class WorkerContextImpl implements WorkerContext { fetch( callback?: (error: Error | null, item?: WorkerInstance) => any ): Promise { + 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( @@ -363,6 +367,7 @@ export class WorkerContextImpl implements WorkerContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -829,6 +834,7 @@ export function WorkerListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -890,6 +896,7 @@ export function WorkerListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/worker/reservation.ts b/src/rest/taskrouter/v1/workspace/worker/reservation.ts index 7aaecaa272..051e7e1911 100644 --- a/src/rest/taskrouter/v1/workspace/worker/reservation.ts +++ b/src/rest/taskrouter/v1/workspace/worker/reservation.ts @@ -275,11 +275,15 @@ export class ReservationContextImpl implements ReservationContext { fetch( callback?: (error: Error | null, item?: ReservationInstance) => any ): Promise { + 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( @@ -434,6 +438,7 @@ export class ReservationContextImpl implements ReservationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; @@ -780,6 +785,7 @@ export function ReservationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/worker/workerChannel.ts b/src/rest/taskrouter/v1/workspace/worker/workerChannel.ts index aeca4e9f94..4e91fc0dcf 100644 --- a/src/rest/taskrouter/v1/workspace/worker/workerChannel.ts +++ b/src/rest/taskrouter/v1/workspace/worker/workerChannel.ts @@ -142,11 +142,15 @@ export class WorkerChannelContextImpl implements WorkerChannelContext { fetch( callback?: (error: Error | null, item?: WorkerChannelInstance) => any ): Promise { + 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( @@ -188,6 +192,7 @@ export class WorkerChannelContextImpl implements WorkerChannelContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -555,6 +560,7 @@ export function WorkerChannelListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/worker/workerStatistics.ts b/src/rest/taskrouter/v1/workspace/worker/workerStatistics.ts index 93b566bdcf..ccfc64fc31 100644 --- a/src/rest/taskrouter/v1/workspace/worker/workerStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/worker/workerStatistics.ts @@ -109,6 +109,7 @@ export class WorkerStatisticsContextImpl implements WorkerStatisticsContext { data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/worker/workersCumulativeStatistics.ts b/src/rest/taskrouter/v1/workspace/worker/workersCumulativeStatistics.ts index f92358bf96..fcdad66cbb 100644 --- a/src/rest/taskrouter/v1/workspace/worker/workersCumulativeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/worker/workersCumulativeStatistics.ts @@ -118,6 +118,7 @@ export class WorkersCumulativeStatisticsContextImpl data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/worker/workersRealTimeStatistics.ts b/src/rest/taskrouter/v1/workspace/worker/workersRealTimeStatistics.ts index b8dfada89b..03cbb4922d 100644 --- a/src/rest/taskrouter/v1/workspace/worker/workersRealTimeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/worker/workersRealTimeStatistics.ts @@ -107,6 +107,7 @@ export class WorkersRealTimeStatisticsContextImpl data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/worker/workersStatistics.ts b/src/rest/taskrouter/v1/workspace/worker/workersStatistics.ts index c9dd5827a8..7408e8326f 100644 --- a/src/rest/taskrouter/v1/workspace/worker/workersStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/worker/workersStatistics.ts @@ -116,6 +116,7 @@ export class WorkersStatisticsContextImpl implements WorkersStatisticsContext { data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/workflow.ts b/src/rest/taskrouter/v1/workspace/workflow.ts index a9eba1608e..52742c7cc9 100644 --- a/src/rest/taskrouter/v1/workspace/workflow.ts +++ b/src/rest/taskrouter/v1/workspace/workflow.ts @@ -217,11 +217,14 @@ export class WorkflowContextImpl implements WorkflowContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -234,11 +237,15 @@ export class WorkflowContextImpl implements WorkflowContext { fetch( callback?: (error: Error | null, item?: WorkflowInstance) => any ): Promise { + 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( @@ -289,6 +296,7 @@ export class WorkflowContextImpl implements WorkflowContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -707,6 +715,7 @@ export function WorkflowListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -755,6 +764,7 @@ export function WorkflowListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.ts b/src/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.ts index 37a96dec2c..ad02e5915f 100644 --- a/src/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.ts @@ -131,6 +131,7 @@ export class WorkflowCumulativeStatisticsContextImpl data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/workflow/workflowRealTimeStatistics.ts b/src/rest/taskrouter/v1/workspace/workflow/workflowRealTimeStatistics.ts index 085d79b9cb..1e22ffcde5 100644 --- a/src/rest/taskrouter/v1/workspace/workflow/workflowRealTimeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/workflow/workflowRealTimeStatistics.ts @@ -116,6 +116,7 @@ export class WorkflowRealTimeStatisticsContextImpl data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/workflow/workflowStatistics.ts b/src/rest/taskrouter/v1/workspace/workflow/workflowStatistics.ts index 45fb1c29ec..85db470ff5 100644 --- a/src/rest/taskrouter/v1/workspace/workflow/workflowStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/workflow/workflowStatistics.ts @@ -119,6 +119,7 @@ export class WorkflowStatisticsContextImpl data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.ts b/src/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.ts index ddf8ba7299..901c47586c 100644 --- a/src/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.ts @@ -122,6 +122,7 @@ export class WorkspaceCumulativeStatisticsContextImpl data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/workspaceRealTimeStatistics.ts b/src/rest/taskrouter/v1/workspace/workspaceRealTimeStatistics.ts index 0a0140dfd9..5d0147ebd1 100644 --- a/src/rest/taskrouter/v1/workspace/workspaceRealTimeStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/workspaceRealTimeStatistics.ts @@ -107,6 +107,7 @@ export class WorkspaceRealTimeStatisticsContextImpl data["TaskChannel"] = params["taskChannel"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/taskrouter/v1/workspace/workspaceStatistics.ts b/src/rest/taskrouter/v1/workspace/workspaceStatistics.ts index 4f294ce5fe..61cf3db2f5 100644 --- a/src/rest/taskrouter/v1/workspace/workspaceStatistics.ts +++ b/src/rest/taskrouter/v1/workspace/workspaceStatistics.ts @@ -110,6 +110,7 @@ export class WorkspaceStatisticsContextImpl data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/trunking/v1/trunk.ts b/src/rest/trunking/v1/trunk.ts index 245f649e21..782c9ffe19 100644 --- a/src/rest/trunking/v1/trunk.ts +++ b/src/rest/trunking/v1/trunk.ts @@ -228,11 +228,14 @@ export class TrunkContextImpl implements TrunkContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -245,11 +248,15 @@ export class TrunkContextImpl implements TrunkContext { fetch( callback?: (error: Error | null, item?: TrunkInstance) => any ): Promise { + 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( @@ -298,6 +305,7 @@ export class TrunkContextImpl implements TrunkContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -730,6 +738,7 @@ export function TrunkListInstance(version: V1): TrunkListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -771,6 +780,7 @@ export function TrunkListInstance(version: V1): TrunkListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trunking/v1/trunk/credentialList.ts b/src/rest/trunking/v1/trunk/credentialList.ts index 57f1bd7604..00b775df37 100644 --- a/src/rest/trunking/v1/trunk/credentialList.ts +++ b/src/rest/trunking/v1/trunk/credentialList.ts @@ -121,11 +121,14 @@ export class CredentialListContextImpl implements CredentialListContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -138,11 +141,15 @@ export class CredentialListContextImpl implements CredentialListContext { fetch( callback?: (error: Error | null, item?: CredentialListInstance) => any ): Promise { + 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( @@ -447,6 +454,7 @@ export function CredentialListListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -493,6 +501,7 @@ export function CredentialListListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trunking/v1/trunk/ipAccessControlList.ts b/src/rest/trunking/v1/trunk/ipAccessControlList.ts index 708c8a2dbe..9fa0bd8c5d 100644 --- a/src/rest/trunking/v1/trunk/ipAccessControlList.ts +++ b/src/rest/trunking/v1/trunk/ipAccessControlList.ts @@ -123,11 +123,14 @@ export class IpAccessControlListContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -140,11 +143,15 @@ export class IpAccessControlListContextImpl fetch( callback?: (error: Error | null, item?: IpAccessControlListInstance) => any ): Promise { + 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( @@ -456,6 +463,7 @@ export function IpAccessControlListListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -502,6 +510,7 @@ export function IpAccessControlListListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trunking/v1/trunk/originationUrl.ts b/src/rest/trunking/v1/trunk/originationUrl.ts index 0e71891836..328b1c86a9 100644 --- a/src/rest/trunking/v1/trunk/originationUrl.ts +++ b/src/rest/trunking/v1/trunk/originationUrl.ts @@ -168,11 +168,14 @@ export class OriginationUrlContextImpl implements OriginationUrlContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -185,11 +188,15 @@ export class OriginationUrlContextImpl implements OriginationUrlContext { fetch( callback?: (error: Error | null, item?: OriginationUrlInstance) => any ): Promise { + 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( @@ -234,6 +241,7 @@ export class OriginationUrlContextImpl implements OriginationUrlContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -626,6 +634,7 @@ export function OriginationUrlListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -672,6 +681,7 @@ export function OriginationUrlListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trunking/v1/trunk/phoneNumber.ts b/src/rest/trunking/v1/trunk/phoneNumber.ts index 398c51fb4b..a97f221544 100644 --- a/src/rest/trunking/v1/trunk/phoneNumber.ts +++ b/src/rest/trunking/v1/trunk/phoneNumber.ts @@ -124,11 +124,14 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -141,11 +144,15 @@ export class PhoneNumberContextImpl implements PhoneNumberContext { fetch( callback?: (error: Error | null, item?: PhoneNumberInstance) => any ): Promise { + 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( @@ -574,6 +581,7 @@ export function PhoneNumberListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -620,6 +628,7 @@ export function PhoneNumberListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trunking/v1/trunk/recording.ts b/src/rest/trunking/v1/trunk/recording.ts index 4d43367405..dae79865b3 100644 --- a/src/rest/trunking/v1/trunk/recording.ts +++ b/src/rest/trunking/v1/trunk/recording.ts @@ -99,11 +99,15 @@ export class RecordingContextImpl implements RecordingContext { fetch( callback?: (error: Error | null, item?: RecordingInstance) => any ): Promise { + 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( @@ -142,6 +146,7 @@ export class RecordingContextImpl implements RecordingContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/trusthub/v1/complianceInquiries.ts b/src/rest/trusthub/v1/complianceInquiries.ts index 6854949c05..bccb0c8182 100644 --- a/src/rest/trusthub/v1/complianceInquiries.ts +++ b/src/rest/trusthub/v1/complianceInquiries.ts @@ -105,6 +105,7 @@ export class ComplianceInquiriesContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -308,6 +309,7 @@ export function ComplianceInquiriesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/trusthub/v1/complianceRegistrationInquiries.ts b/src/rest/trusthub/v1/complianceRegistrationInquiries.ts index a24d8589e7..c71c5739f3 100644 --- a/src/rest/trusthub/v1/complianceRegistrationInquiries.ts +++ b/src/rest/trusthub/v1/complianceRegistrationInquiries.ts @@ -218,6 +218,7 @@ export class ComplianceRegistrationInquiriesContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -541,6 +542,7 @@ export function ComplianceRegistrationInquiriesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/trusthub/v1/complianceTollfreeInquiries.ts b/src/rest/trusthub/v1/complianceTollfreeInquiries.ts index b9beeb22bc..a6eb881471 100644 --- a/src/rest/trusthub/v1/complianceTollfreeInquiries.ts +++ b/src/rest/trusthub/v1/complianceTollfreeInquiries.ts @@ -204,6 +204,7 @@ export function ComplianceTollfreeInquiriesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/trusthub/v1/customerProfiles.ts b/src/rest/trusthub/v1/customerProfiles.ts index 744a5661f4..3ee5e3e006 100644 --- a/src/rest/trusthub/v1/customerProfiles.ts +++ b/src/rest/trusthub/v1/customerProfiles.ts @@ -225,11 +225,14 @@ export class CustomerProfilesContextImpl implements CustomerProfilesContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -242,11 +245,15 @@ export class CustomerProfilesContextImpl implements CustomerProfilesContext { fetch( callback?: (error: Error | null, item?: CustomerProfilesInstance) => any ): Promise { + 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( @@ -289,6 +296,7 @@ export class CustomerProfilesContextImpl implements CustomerProfilesContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -690,6 +698,7 @@ export function CustomerProfilesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -736,6 +745,7 @@ export function CustomerProfilesListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.ts b/src/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.ts index febbcb3fd4..ab848abdae 100644 --- a/src/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.ts +++ b/src/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.ts @@ -140,11 +140,14 @@ export class CustomerProfilesChannelEndpointAssignmentContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -160,11 +163,15 @@ export class CustomerProfilesChannelEndpointAssignmentContextImpl item?: CustomerProfilesChannelEndpointAssignmentInstance ) => any ): Promise { + 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( @@ -512,6 +519,7 @@ export function CustomerProfilesChannelEndpointAssignmentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -568,6 +576,7 @@ export function CustomerProfilesChannelEndpointAssignmentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.ts b/src/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.ts index a938f6f512..284f08410f 100644 --- a/src/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.ts +++ b/src/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.ts @@ -132,11 +132,14 @@ export class CustomerProfilesEntityAssignmentsContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -152,11 +155,15 @@ export class CustomerProfilesEntityAssignmentsContextImpl item?: CustomerProfilesEntityAssignmentsInstance ) => any ): Promise { + 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( @@ -479,6 +486,7 @@ export function CustomerProfilesEntityAssignmentsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -533,6 +541,7 @@ export function CustomerProfilesEntityAssignmentsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.ts b/src/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.ts index 4be4b10359..1c95ebd2aa 100644 --- a/src/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.ts +++ b/src/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.ts @@ -120,11 +120,15 @@ export class CustomerProfilesEvaluationsContextImpl item?: CustomerProfilesEvaluationsInstance ) => any ): Promise { + 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( @@ -438,6 +442,7 @@ export function CustomerProfilesEvaluationsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -487,6 +492,7 @@ export function CustomerProfilesEvaluationsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/endUser.ts b/src/rest/trusthub/v1/endUser.ts index fcd67edb6a..b4d63a5810 100644 --- a/src/rest/trusthub/v1/endUser.ts +++ b/src/rest/trusthub/v1/endUser.ts @@ -150,11 +150,14 @@ export class EndUserContextImpl implements EndUserContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class EndUserContextImpl implements EndUserContext { fetch( callback?: (error: Error | null, item?: EndUserInstance) => any ): Promise { + 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( @@ -208,6 +215,7 @@ export class EndUserContextImpl implements EndUserContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -534,6 +542,7 @@ export function EndUserListInstance(version: V1): EndUserListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -575,6 +584,7 @@ export function EndUserListInstance(version: V1): EndUserListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/endUserType.ts b/src/rest/trusthub/v1/endUserType.ts index 22242de166..0632ea85ae 100644 --- a/src/rest/trusthub/v1/endUserType.ts +++ b/src/rest/trusthub/v1/endUserType.ts @@ -95,11 +95,15 @@ export class EndUserTypeContextImpl implements EndUserTypeContext { fetch( callback?: (error: Error | null, item?: EndUserTypeInstance) => any ): Promise { + 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( @@ -341,6 +345,7 @@ export function EndUserTypeListInstance(version: V1): EndUserTypeListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/policies.ts b/src/rest/trusthub/v1/policies.ts index 3b629fa240..43a75fb51d 100644 --- a/src/rest/trusthub/v1/policies.ts +++ b/src/rest/trusthub/v1/policies.ts @@ -95,11 +95,15 @@ export class PoliciesContextImpl implements PoliciesContext { fetch( callback?: (error: Error | null, item?: PoliciesInstance) => any ): Promise { + 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( @@ -326,6 +330,7 @@ export function PoliciesListInstance(version: V1): PoliciesListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/supportingDocument.ts b/src/rest/trusthub/v1/supportingDocument.ts index f9dc3cce0d..4a7756b0bc 100644 --- a/src/rest/trusthub/v1/supportingDocument.ts +++ b/src/rest/trusthub/v1/supportingDocument.ts @@ -163,11 +163,14 @@ export class SupportingDocumentContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -180,11 +183,15 @@ export class SupportingDocumentContextImpl fetch( callback?: (error: Error | null, item?: SupportingDocumentInstance) => any ): Promise { + 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( @@ -225,6 +232,7 @@ export class SupportingDocumentContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -579,6 +587,7 @@ export function SupportingDocumentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -620,6 +629,7 @@ export function SupportingDocumentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/supportingDocumentType.ts b/src/rest/trusthub/v1/supportingDocumentType.ts index f6273a12ce..2c0936acd5 100644 --- a/src/rest/trusthub/v1/supportingDocumentType.ts +++ b/src/rest/trusthub/v1/supportingDocumentType.ts @@ -106,11 +106,15 @@ export class SupportingDocumentTypeContextImpl item?: SupportingDocumentTypeInstance ) => any ): Promise { + 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( @@ -370,6 +374,7 @@ export function SupportingDocumentTypeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/trustProducts.ts b/src/rest/trusthub/v1/trustProducts.ts index 3db9c5915f..22ed8803aa 100644 --- a/src/rest/trusthub/v1/trustProducts.ts +++ b/src/rest/trusthub/v1/trustProducts.ts @@ -219,11 +219,14 @@ export class TrustProductsContextImpl implements TrustProductsContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -236,11 +239,15 @@ export class TrustProductsContextImpl implements TrustProductsContext { fetch( callback?: (error: Error | null, item?: TrustProductsInstance) => any ): Promise { + 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( @@ -283,6 +290,7 @@ export class TrustProductsContextImpl implements TrustProductsContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -684,6 +692,7 @@ export function TrustProductsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -730,6 +739,7 @@ export function TrustProductsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.ts b/src/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.ts index 62e042c16f..659e00e524 100644 --- a/src/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.ts +++ b/src/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.ts @@ -140,11 +140,14 @@ export class TrustProductsChannelEndpointAssignmentContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -160,11 +163,15 @@ export class TrustProductsChannelEndpointAssignmentContextImpl item?: TrustProductsChannelEndpointAssignmentInstance ) => any ): Promise { + 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( @@ -512,6 +519,7 @@ export function TrustProductsChannelEndpointAssignmentListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -568,6 +576,7 @@ export function TrustProductsChannelEndpointAssignmentListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.ts b/src/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.ts index c2b688a518..7ae9f7645e 100644 --- a/src/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.ts +++ b/src/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.ts @@ -132,11 +132,14 @@ export class TrustProductsEntityAssignmentsContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -152,11 +155,15 @@ export class TrustProductsEntityAssignmentsContextImpl item?: TrustProductsEntityAssignmentsInstance ) => any ): Promise { + 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( @@ -478,6 +485,7 @@ export function TrustProductsEntityAssignmentsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -532,6 +540,7 @@ export function TrustProductsEntityAssignmentsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/trusthub/v1/trustProducts/trustProductsEvaluations.ts b/src/rest/trusthub/v1/trustProducts/trustProductsEvaluations.ts index 7eaef90a0d..6c9dd24c0e 100644 --- a/src/rest/trusthub/v1/trustProducts/trustProductsEvaluations.ts +++ b/src/rest/trusthub/v1/trustProducts/trustProductsEvaluations.ts @@ -120,11 +120,15 @@ export class TrustProductsEvaluationsContextImpl item?: TrustProductsEvaluationsInstance ) => any ): Promise { + 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( @@ -429,6 +433,7 @@ export function TrustProductsEvaluationsListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -475,6 +480,7 @@ export function TrustProductsEvaluationsListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/form.ts b/src/rest/verify/v2/form.ts index 0a021fc24f..ab7017c3c4 100644 --- a/src/rest/verify/v2/form.ts +++ b/src/rest/verify/v2/form.ts @@ -59,11 +59,15 @@ export class FormContextImpl implements FormContext { fetch( callback?: (error: Error | null, item?: FormInstance) => any ): Promise { + 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( diff --git a/src/rest/verify/v2/safelist.ts b/src/rest/verify/v2/safelist.ts index 92cd8ac997..47a394dc5d 100644 --- a/src/rest/verify/v2/safelist.ts +++ b/src/rest/verify/v2/safelist.ts @@ -76,11 +76,14 @@ export class SafelistContextImpl implements SafelistContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -93,11 +96,15 @@ export class SafelistContextImpl implements SafelistContext { fetch( callback?: (error: Error | null, item?: SafelistInstance) => any ): Promise { + 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( @@ -278,6 +285,7 @@ export function SafelistListInstance(version: V2): SafelistListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/verify/v2/service.ts b/src/rest/verify/v2/service.ts index 7cab81b2f5..c39ad97981 100644 --- a/src/rest/verify/v2/service.ts +++ b/src/rest/verify/v2/service.ts @@ -290,11 +290,14 @@ export class ServiceContextImpl implements ServiceContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -307,11 +310,15 @@ export class ServiceContextImpl implements ServiceContext { fetch( callback?: (error: Error | null, item?: ServiceInstance) => any ): Promise { + 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( @@ -387,6 +394,7 @@ export class ServiceContextImpl implements ServiceContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -874,6 +882,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -915,6 +924,7 @@ export function ServiceListInstance(version: V2): ServiceListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/accessToken.ts b/src/rest/verify/v2/service/accessToken.ts index 9833362f63..45f7100cc0 100644 --- a/src/rest/verify/v2/service/accessToken.ts +++ b/src/rest/verify/v2/service/accessToken.ts @@ -78,11 +78,15 @@ export class AccessTokenContextImpl implements AccessTokenContext { fetch( callback?: (error: Error | null, item?: AccessTokenInstance) => any ): Promise { + 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( @@ -319,6 +323,7 @@ export function AccessTokenListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/verify/v2/service/entity.ts b/src/rest/verify/v2/service/entity.ts index 680144b757..518a733faf 100644 --- a/src/rest/verify/v2/service/entity.ts +++ b/src/rest/verify/v2/service/entity.ts @@ -162,11 +162,14 @@ export class EntityContextImpl implements EntityContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -179,11 +182,15 @@ export class EntityContextImpl implements EntityContext { fetch( callback?: (error: Error | null, item?: EntityInstance) => any ): Promise { + 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( @@ -505,6 +512,7 @@ export function EntityListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -551,6 +559,7 @@ export function EntityListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/entity/challenge.ts b/src/rest/verify/v2/service/entity/challenge.ts index 19422a54bf..839ea750a2 100644 --- a/src/rest/verify/v2/service/entity/challenge.ts +++ b/src/rest/verify/v2/service/entity/challenge.ts @@ -207,11 +207,15 @@ export class ChallengeContextImpl implements ChallengeContext { fetch( callback?: (error: Error | null, item?: ChallengeInstance) => any ): Promise { + 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( @@ -254,6 +258,7 @@ export class ChallengeContextImpl implements ChallengeContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -671,6 +676,7 @@ export function ChallengeListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -722,6 +728,7 @@ export function ChallengeListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/entity/challenge/notification.ts b/src/rest/verify/v2/service/entity/challenge/notification.ts index ec6a8534a4..6566ea1e3f 100644 --- a/src/rest/verify/v2/service/entity/challenge/notification.ts +++ b/src/rest/verify/v2/service/entity/challenge/notification.ts @@ -110,6 +110,7 @@ export function NotificationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/verify/v2/service/entity/factor.ts b/src/rest/verify/v2/service/entity/factor.ts index 32118485bc..22400009e9 100644 --- a/src/rest/verify/v2/service/entity/factor.ts +++ b/src/rest/verify/v2/service/entity/factor.ts @@ -173,11 +173,14 @@ export class FactorContextImpl implements FactorContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -190,11 +193,15 @@ export class FactorContextImpl implements FactorContext { fetch( callback?: (error: Error | null, item?: FactorInstance) => any ): Promise { + 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( @@ -252,6 +259,7 @@ export class FactorContextImpl implements FactorContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -618,6 +626,7 @@ export function FactorListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/entity/newFactor.ts b/src/rest/verify/v2/service/entity/newFactor.ts index 96f33fd285..a233bdf505 100644 --- a/src/rest/verify/v2/service/entity/newFactor.ts +++ b/src/rest/verify/v2/service/entity/newFactor.ts @@ -161,6 +161,7 @@ export function NewFactorListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/verify/v2/service/messagingConfiguration.ts b/src/rest/verify/v2/service/messagingConfiguration.ts index 59cbc7dd57..433897c692 100644 --- a/src/rest/verify/v2/service/messagingConfiguration.ts +++ b/src/rest/verify/v2/service/messagingConfiguration.ts @@ -152,11 +152,14 @@ export class MessagingConfigurationContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -172,11 +175,15 @@ export class MessagingConfigurationContextImpl item?: MessagingConfigurationInstance ) => any ): Promise { + 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( @@ -222,6 +229,7 @@ export class MessagingConfigurationContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -582,6 +590,7 @@ export function MessagingConfigurationListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -628,6 +637,7 @@ export function MessagingConfigurationListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/rateLimit.ts b/src/rest/verify/v2/service/rateLimit.ts index aabe9f75af..5acdd7f1ea 100644 --- a/src/rest/verify/v2/service/rateLimit.ts +++ b/src/rest/verify/v2/service/rateLimit.ts @@ -167,11 +167,14 @@ export class RateLimitContextImpl implements RateLimitContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -184,11 +187,15 @@ export class RateLimitContextImpl implements RateLimitContext { fetch( callback?: (error: Error | null, item?: RateLimitInstance) => any ): Promise { + 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( @@ -228,6 +235,7 @@ export class RateLimitContextImpl implements RateLimitContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -582,6 +590,7 @@ export function RateLimitListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -628,6 +637,7 @@ export function RateLimitListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/rateLimit/bucket.ts b/src/rest/verify/v2/service/rateLimit/bucket.ts index 75c82e9471..ff8310b27f 100644 --- a/src/rest/verify/v2/service/rateLimit/bucket.ts +++ b/src/rest/verify/v2/service/rateLimit/bucket.ts @@ -163,11 +163,14 @@ export class BucketContextImpl implements BucketContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -180,11 +183,15 @@ export class BucketContextImpl implements BucketContext { fetch( callback?: (error: Error | null, item?: BucketInstance) => any ): Promise { + 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( @@ -225,6 +232,7 @@ export class BucketContextImpl implements BucketContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -585,6 +593,7 @@ export function BucketListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -632,6 +641,7 @@ export function BucketListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/service/verification.ts b/src/rest/verify/v2/service/verification.ts index f58804f8c8..dece77203f 100644 --- a/src/rest/verify/v2/service/verification.ts +++ b/src/rest/verify/v2/service/verification.ts @@ -66,6 +66,8 @@ export interface VerificationListInstanceCreateOptions { templateCustomSubstitutions?: string; /** Strongly encouraged if using the auto channel. The IP address of the client\\\'s device. If provided, it has to be a valid IPv4 or IPv6 address. */ deviceIp?: string; + /** An optional Boolean value to indicate the requirement of sna client token in the SNA URL invocation response for added security. This token must match in the Verification Check request to confirm phone number verification. */ + enableSnaClientToken?: boolean; /** */ riskCheck?: VerificationRiskCheck; /** 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. */ @@ -129,11 +131,15 @@ export class VerificationContextImpl implements VerificationContext { fetch( callback?: (error: Error | null, item?: VerificationInstance) => any ): Promise { + 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( @@ -171,6 +177,7 @@ export class VerificationContextImpl implements VerificationContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -488,12 +495,17 @@ export function VerificationListInstance( data["TemplateCustomSubstitutions"] = params["templateCustomSubstitutions"]; if (params["deviceIp"] !== undefined) data["DeviceIp"] = params["deviceIp"]; + if (params["enableSnaClientToken"] !== undefined) + data["EnableSnaClientToken"] = serialize.bool( + params["enableSnaClientToken"] + ); if (params["riskCheck"] !== undefined) data["RiskCheck"] = params["riskCheck"]; if (params["tags"] !== undefined) data["Tags"] = params["tags"]; const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/verify/v2/service/verificationCheck.ts b/src/rest/verify/v2/service/verificationCheck.ts index 4d642bb8db..3517e56f40 100644 --- a/src/rest/verify/v2/service/verificationCheck.ts +++ b/src/rest/verify/v2/service/verificationCheck.ts @@ -39,6 +39,8 @@ export interface VerificationCheckListInstanceCreateOptions { amount?: string; /** The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ payee?: string; + /** A sna client token received in sna url invocation response needs to be passed in Verification Check request and should match to get successful response. */ + snaClientToken?: string; } export interface VerificationCheckSolution { @@ -115,9 +117,12 @@ export function VerificationCheckListInstance( data["VerificationSid"] = params["verificationSid"]; if (params["amount"] !== undefined) data["Amount"] = params["amount"]; if (params["payee"] !== undefined) data["Payee"] = params["payee"]; + if (params["snaClientToken"] !== undefined) + data["SnaClientToken"] = params["snaClientToken"]; const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/verify/v2/service/webhook.ts b/src/rest/verify/v2/service/webhook.ts index 09ea06d7bf..ea78fa8331 100644 --- a/src/rest/verify/v2/service/webhook.ts +++ b/src/rest/verify/v2/service/webhook.ts @@ -171,11 +171,14 @@ export class WebhookContextImpl implements WebhookContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -188,11 +191,15 @@ export class WebhookContextImpl implements WebhookContext { fetch( callback?: (error: Error | null, item?: WebhookInstance) => any ): Promise { + 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( @@ -241,6 +248,7 @@ export class WebhookContextImpl implements WebhookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -615,6 +623,7 @@ export function WebhookListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -661,6 +670,7 @@ export function WebhookListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/template.ts b/src/rest/verify/v2/template.ts index 1f5c7e1cda..9c8f59d5db 100644 --- a/src/rest/verify/v2/template.ts +++ b/src/rest/verify/v2/template.ts @@ -175,6 +175,7 @@ export function TemplateListInstance(version: V2): TemplateListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/verificationAttempt.ts b/src/rest/verify/v2/verificationAttempt.ts index b4e096ca4d..61f52a981b 100644 --- a/src/rest/verify/v2/verificationAttempt.ts +++ b/src/rest/verify/v2/verificationAttempt.ts @@ -152,11 +152,15 @@ export class VerificationAttemptContextImpl fetch( callback?: (error: Error | null, item?: VerificationAttemptInstance) => any ): Promise { + 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( @@ -463,6 +467,7 @@ export function VerificationAttemptListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/verify/v2/verificationAttemptsSummary.ts b/src/rest/verify/v2/verificationAttemptsSummary.ts index 1222f93583..1ae01b3c52 100644 --- a/src/rest/verify/v2/verificationAttemptsSummary.ts +++ b/src/rest/verify/v2/verificationAttemptsSummary.ts @@ -129,6 +129,7 @@ export class VerificationAttemptsSummaryContextImpl data["DestinationPrefix"] = params["destinationPrefix"]; const headers: any = {}; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/video/v1/composition.ts b/src/rest/video/v1/composition.ts index 9e0e5e81db..f04cede9e8 100644 --- a/src/rest/video/v1/composition.ts +++ b/src/rest/video/v1/composition.ts @@ -162,11 +162,14 @@ export class CompositionContextImpl implements CompositionContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -179,11 +182,15 @@ export class CompositionContextImpl implements CompositionContext { fetch( callback?: (error: Error | null, item?: CompositionInstance) => any ): Promise { + 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( @@ -575,6 +582,7 @@ export function CompositionListInstance(version: V1): CompositionListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -626,6 +634,7 @@ export function CompositionListInstance(version: V1): CompositionListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/compositionHook.ts b/src/rest/video/v1/compositionHook.ts index f8b298d8e9..fd307332fd 100644 --- a/src/rest/video/v1/compositionHook.ts +++ b/src/rest/video/v1/compositionHook.ts @@ -199,11 +199,14 @@ export class CompositionHookContextImpl implements CompositionHookContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -216,11 +219,15 @@ export class CompositionHookContextImpl implements CompositionHookContext { fetch( callback?: (error: Error | null, item?: CompositionHookInstance) => any ): Promise { + 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( @@ -283,6 +290,7 @@ export class CompositionHookContextImpl implements CompositionHookContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -676,6 +684,7 @@ export function CompositionHookListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -729,6 +738,7 @@ export function CompositionHookListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/compositionSettings.ts b/src/rest/video/v1/compositionSettings.ts index 143133bb1b..f92bc639ef 100644 --- a/src/rest/video/v1/compositionSettings.ts +++ b/src/rest/video/v1/compositionSettings.ts @@ -111,6 +111,7 @@ export class CompositionSettingsContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -135,11 +136,15 @@ export class CompositionSettingsContextImpl fetch( callback?: (error: Error | null, item?: CompositionSettingsInstance) => any ): Promise { + 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( diff --git a/src/rest/video/v1/recording.ts b/src/rest/video/v1/recording.ts index 808593a3f4..b88aa5dcee 100644 --- a/src/rest/video/v1/recording.ts +++ b/src/rest/video/v1/recording.ts @@ -150,11 +150,14 @@ export class RecordingContextImpl implements RecordingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -167,11 +170,15 @@ export class RecordingContextImpl implements RecordingContext { fetch( callback?: (error: Error | null, item?: RecordingInstance) => any ): Promise { + 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( @@ -519,6 +526,7 @@ export function RecordingListInstance(version: V1): RecordingListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/recordingSettings.ts b/src/rest/video/v1/recordingSettings.ts index 0bd2346bd7..7adfa3c8a3 100644 --- a/src/rest/video/v1/recordingSettings.ts +++ b/src/rest/video/v1/recordingSettings.ts @@ -109,6 +109,7 @@ export class RecordingSettingsContextImpl implements RecordingSettingsContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -133,11 +134,15 @@ export class RecordingSettingsContextImpl implements RecordingSettingsContext { fetch( callback?: (error: Error | null, item?: RecordingSettingsInstance) => any ): Promise { + 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( diff --git a/src/rest/video/v1/room.ts b/src/rest/video/v1/room.ts index c54355d056..0fd136d426 100644 --- a/src/rest/video/v1/room.ts +++ b/src/rest/video/v1/room.ts @@ -47,21 +47,21 @@ export interface RoomListInstanceCreateOptions { type?: RoomRoomType; /** An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource\\\'s `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. */ uniqueName?: string; - /** The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. */ + /** The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. */ statusCallback?: string; - /** The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. */ + /** The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. */ statusCallbackMethod?: string; - /** The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. */ + /** The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. */ maxParticipants?: number; - /** Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** */ + /** Whether to start recording when Participants connect. */ recordParticipantsOnConnect?: boolean; - /** An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** */ + /** An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. */ videoCodecs?: Array; - /** The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** */ + /** The region for the Room\\\'s media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). */ mediaRegion?: string; /** A collection of Recording Rules that describe how to include or exclude matching tracks for recording */ recordingRules?: any; - /** When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. */ + /** When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. */ audioOnly?: boolean; /** The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). */ maxParticipantDuration?: number; @@ -213,11 +213,15 @@ export class RoomContextImpl implements RoomContext { fetch( callback?: (error: Error | null, item?: RoomInstance) => any ): Promise { + 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( @@ -250,6 +254,7 @@ export class RoomContextImpl implements RoomContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -355,7 +360,7 @@ export class RoomInstance { } /** - * The unique string that we created to identify the Room resource. + * The unique string that Twilio created to identify the Room resource. */ sid: string; status: RoomRoomStatus; @@ -380,11 +385,11 @@ export class RoomInstance { */ uniqueName: string; /** - * The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + * The URL Twilio calls using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. */ statusCallback: string; /** - * The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + * The HTTP method Twilio uses to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. */ statusCallbackMethod: string; /** @@ -409,19 +414,19 @@ export class RoomInstance { */ maxConcurrentPublishedTracks: number; /** - * Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** + * Whether to start recording when Participants connect. */ recordParticipantsOnConnect: boolean; /** - * An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** + * An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. */ videoCodecs: Array; /** - * The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + * The region for the Room\'s media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). */ mediaRegion: string; /** - * When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + * When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. */ audioOnly: boolean; /** @@ -716,6 +721,7 @@ export function RoomListInstance(version: V1): RoomListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -768,6 +774,7 @@ export function RoomListInstance(version: V1): RoomListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/room/participant.ts b/src/rest/video/v1/room/participant.ts index e769c3ff17..443a374e4e 100644 --- a/src/rest/video/v1/room/participant.ts +++ b/src/rest/video/v1/room/participant.ts @@ -214,11 +214,15 @@ export class ParticipantContextImpl implements ParticipantContext { fetch( callback?: (error: Error | null, item?: ParticipantInstance) => any ): Promise { + 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( @@ -257,6 +261,7 @@ export class ParticipantContextImpl implements ParticipantContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -635,6 +640,7 @@ export function ParticipantListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/room/participant/anonymize.ts b/src/rest/video/v1/room/participant/anonymize.ts index 60afd66657..d4ee3d641e 100644 --- a/src/rest/video/v1/room/participant/anonymize.ts +++ b/src/rest/video/v1/room/participant/anonymize.ts @@ -64,11 +64,15 @@ export class AnonymizeContextImpl implements AnonymizeContext { update( callback?: (error: Error | null, item?: AnonymizeInstance) => any ): Promise { + 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( diff --git a/src/rest/video/v1/room/participant/publishedTrack.ts b/src/rest/video/v1/room/participant/publishedTrack.ts index 23ae30bad8..e56ee98c3f 100644 --- a/src/rest/video/v1/room/participant/publishedTrack.ts +++ b/src/rest/video/v1/room/participant/publishedTrack.ts @@ -115,11 +115,15 @@ export class PublishedTrackContextImpl implements PublishedTrackContext { fetch( callback?: (error: Error | null, item?: PublishedTrackInstance) => any ): Promise { + 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( @@ -416,6 +420,7 @@ export function PublishedTrackListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/room/participant/subscribeRules.ts b/src/rest/video/v1/room/participant/subscribeRules.ts index 8f21cc0dff..1c0b6a04df 100644 --- a/src/rest/video/v1/room/participant/subscribeRules.ts +++ b/src/rest/video/v1/room/participant/subscribeRules.ts @@ -108,10 +108,14 @@ export function SubscribeRulesListInstance( instance.fetch = function fetch( callback?: (error: Error | null, items: SubscribeRulesInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", + headers, }); operationPromise = operationPromise.then( @@ -151,6 +155,7 @@ export function SubscribeRulesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.update({ diff --git a/src/rest/video/v1/room/participant/subscribedTrack.ts b/src/rest/video/v1/room/participant/subscribedTrack.ts index f25c0f3561..ed4c1ffb4a 100644 --- a/src/rest/video/v1/room/participant/subscribedTrack.ts +++ b/src/rest/video/v1/room/participant/subscribedTrack.ts @@ -115,11 +115,15 @@ export class SubscribedTrackContextImpl implements SubscribedTrackContext { fetch( callback?: (error: Error | null, item?: SubscribedTrackInstance) => any ): Promise { + 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( @@ -428,6 +432,7 @@ export function SubscribedTrackListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/video/v1/room/recordingRules.ts b/src/rest/video/v1/room/recordingRules.ts index 635032ca01..d34ec18ab1 100644 --- a/src/rest/video/v1/room/recordingRules.ts +++ b/src/rest/video/v1/room/recordingRules.ts @@ -101,10 +101,14 @@ export function RecordingRulesListInstance( instance.fetch = function fetch( callback?: (error: Error | null, items: RecordingRulesInstance) => any ): Promise { + const headers: any = {}; + headers["Accept"] = "application/json"; + let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", + headers, }); operationPromise = operationPromise.then( @@ -143,6 +147,7 @@ export function RecordingRulesListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.update({ diff --git a/src/rest/video/v1/room/roomRecording.ts b/src/rest/video/v1/room/roomRecording.ts index d149f5affc..2e516da30c 100644 --- a/src/rest/video/v1/room/roomRecording.ts +++ b/src/rest/video/v1/room/roomRecording.ts @@ -147,11 +147,14 @@ export class RoomRecordingContextImpl implements RoomRecordingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -164,11 +167,15 @@ export class RoomRecordingContextImpl implements RoomRecordingContext { fetch( callback?: (error: Error | null, item?: RoomRecordingInstance) => any ): Promise { + 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( @@ -527,6 +534,7 @@ export function RoomRecordingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/archivedCall.ts b/src/rest/voice/v1/archivedCall.ts index 3f8a7f56d9..3304a969f6 100644 --- a/src/rest/voice/v1/archivedCall.ts +++ b/src/rest/voice/v1/archivedCall.ts @@ -62,11 +62,14 @@ export class ArchivedCallContextImpl implements ArchivedCallContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( diff --git a/src/rest/voice/v1/byocTrunk.ts b/src/rest/voice/v1/byocTrunk.ts index fe6f02b73e..a2834bbb39 100644 --- a/src/rest/voice/v1/byocTrunk.ts +++ b/src/rest/voice/v1/byocTrunk.ts @@ -180,11 +180,14 @@ export class ByocTrunkContextImpl implements ByocTrunkContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -197,11 +200,15 @@ export class ByocTrunkContextImpl implements ByocTrunkContext { fetch( callback?: (error: Error | null, item?: ByocTrunkInstance) => any ): Promise { + 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( @@ -253,6 +260,7 @@ export class ByocTrunkContextImpl implements ByocTrunkContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -650,6 +658,7 @@ export function ByocTrunkListInstance(version: V1): ByocTrunkListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -691,6 +700,7 @@ export function ByocTrunkListInstance(version: V1): ByocTrunkListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/connectionPolicy.ts b/src/rest/voice/v1/connectionPolicy.ts index a1282aab3b..f4e77b6b53 100644 --- a/src/rest/voice/v1/connectionPolicy.ts +++ b/src/rest/voice/v1/connectionPolicy.ts @@ -159,11 +159,14 @@ export class ConnectionPolicyContextImpl implements ConnectionPolicyContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -176,11 +179,15 @@ export class ConnectionPolicyContextImpl implements ConnectionPolicyContext { fetch( callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any ): Promise { + 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( @@ -219,6 +226,7 @@ export class ConnectionPolicyContextImpl implements ConnectionPolicyContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -562,6 +570,7 @@ export function ConnectionPolicyListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -603,6 +612,7 @@ export function ConnectionPolicyListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/connectionPolicy/connectionPolicyTarget.ts b/src/rest/voice/v1/connectionPolicy/connectionPolicyTarget.ts index aff8e31c9b..a3b25faa70 100644 --- a/src/rest/voice/v1/connectionPolicy/connectionPolicyTarget.ts +++ b/src/rest/voice/v1/connectionPolicy/connectionPolicyTarget.ts @@ -183,11 +183,14 @@ export class ConnectionPolicyTargetContextImpl remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -203,11 +206,15 @@ export class ConnectionPolicyTargetContextImpl item?: ConnectionPolicyTargetInstance ) => any ): Promise { + 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( @@ -255,6 +262,7 @@ export class ConnectionPolicyTargetContextImpl const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -655,6 +663,7 @@ export function ConnectionPolicyTargetListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -701,6 +710,7 @@ export function ConnectionPolicyTargetListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/dialingPermissions/bulkCountryUpdate.ts b/src/rest/voice/v1/dialingPermissions/bulkCountryUpdate.ts index d5083bae73..7844a39dff 100644 --- a/src/rest/voice/v1/dialingPermissions/bulkCountryUpdate.ts +++ b/src/rest/voice/v1/dialingPermissions/bulkCountryUpdate.ts @@ -85,6 +85,7 @@ export function BulkCountryUpdateListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ diff --git a/src/rest/voice/v1/dialingPermissions/country.ts b/src/rest/voice/v1/dialingPermissions/country.ts index cde73d481c..2b917f7ba3 100644 --- a/src/rest/voice/v1/dialingPermissions/country.ts +++ b/src/rest/voice/v1/dialingPermissions/country.ts @@ -143,11 +143,15 @@ export class CountryContextImpl implements CountryContext { fetch( callback?: (error: Error | null, item?: CountryInstance) => any ): Promise { + 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( @@ -443,6 +447,7 @@ export function CountryListInstance(version: V1): CountryListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.ts b/src/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.ts index dd968b7cb4..2e747108d4 100644 --- a/src/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.ts +++ b/src/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.ts @@ -191,6 +191,7 @@ export function HighriskSpecialPrefixListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/dialingPermissions/settings.ts b/src/rest/voice/v1/dialingPermissions/settings.ts index eb2345632d..1c2ba350bb 100644 --- a/src/rest/voice/v1/dialingPermissions/settings.ts +++ b/src/rest/voice/v1/dialingPermissions/settings.ts @@ -82,11 +82,15 @@ export class SettingsContextImpl implements SettingsContext { fetch( callback?: (error: Error | null, item?: SettingsInstance) => any ): Promise { + 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( @@ -122,6 +126,7 @@ export class SettingsContextImpl implements SettingsContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, diff --git a/src/rest/voice/v1/ipRecord.ts b/src/rest/voice/v1/ipRecord.ts index f75039424d..6a8488d1e3 100644 --- a/src/rest/voice/v1/ipRecord.ts +++ b/src/rest/voice/v1/ipRecord.ts @@ -148,11 +148,14 @@ export class IpRecordContextImpl implements IpRecordContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -165,11 +168,15 @@ export class IpRecordContextImpl implements IpRecordContext { fetch( callback?: (error: Error | null, item?: IpRecordInstance) => any ): Promise { + 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( @@ -204,6 +211,7 @@ export class IpRecordContextImpl implements IpRecordContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -523,6 +531,7 @@ export function IpRecordListInstance(version: V1): IpRecordListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -564,6 +573,7 @@ export function IpRecordListInstance(version: V1): IpRecordListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/voice/v1/sourceIpMapping.ts b/src/rest/voice/v1/sourceIpMapping.ts index b903b404d6..c72a761e4f 100644 --- a/src/rest/voice/v1/sourceIpMapping.ts +++ b/src/rest/voice/v1/sourceIpMapping.ts @@ -139,11 +139,14 @@ export class SourceIpMappingContextImpl implements SourceIpMappingContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -156,11 +159,15 @@ export class SourceIpMappingContextImpl implements SourceIpMappingContext { fetch( callback?: (error: Error | null, item?: SourceIpMappingInstance) => any ): Promise { + 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( @@ -200,6 +207,7 @@ export class SourceIpMappingContextImpl implements SourceIpMappingContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -516,6 +524,7 @@ export function SourceIpMappingListInstance( const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -557,6 +566,7 @@ export function SourceIpMappingListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/wireless/v1/command.ts b/src/rest/wireless/v1/command.ts index 66cc27adfb..5df6b86759 100644 --- a/src/rest/wireless/v1/command.ts +++ b/src/rest/wireless/v1/command.ts @@ -162,11 +162,14 @@ export class CommandContextImpl implements CommandContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -179,11 +182,15 @@ export class CommandContextImpl implements CommandContext { fetch( callback?: (error: Error | null, item?: CommandInstance) => any ): Promise { + 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( @@ -490,6 +497,7 @@ export function CommandListInstance(version: V1): CommandListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -537,6 +545,7 @@ export function CommandListInstance(version: V1): CommandListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/wireless/v1/ratePlan.ts b/src/rest/wireless/v1/ratePlan.ts index e43acafe32..106f21c918 100644 --- a/src/rest/wireless/v1/ratePlan.ts +++ b/src/rest/wireless/v1/ratePlan.ts @@ -166,11 +166,14 @@ export class RatePlanContextImpl implements RatePlanContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -183,11 +186,15 @@ export class RatePlanContextImpl implements RatePlanContext { fetch( callback?: (error: Error | null, item?: RatePlanInstance) => any ): Promise { + 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( @@ -224,6 +231,7 @@ export class RatePlanContextImpl implements RatePlanContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -637,6 +645,7 @@ export function RatePlanListInstance(version: V1): RatePlanListInstance { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ @@ -678,6 +687,7 @@ export function RatePlanListInstance(version: V1): RatePlanListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/wireless/v1/sim.ts b/src/rest/wireless/v1/sim.ts index fc5f8b8228..9f28a84d04 100644 --- a/src/rest/wireless/v1/sim.ts +++ b/src/rest/wireless/v1/sim.ts @@ -234,11 +234,14 @@ export class SimContextImpl implements SimContext { remove( callback?: (error: Error | null, item?: boolean) => any ): Promise { + const headers: any = {}; + const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", + headers, }); operationPromise = instance._version.setPromiseCallback( @@ -251,11 +254,15 @@ export class SimContextImpl implements SimContext { fetch( callback?: (error: Error | null, item?: SimInstance) => any ): Promise { + 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( @@ -320,6 +327,7 @@ export class SimContextImpl implements SimContext { const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; + headers["Accept"] = "application/json"; const instance = this; let operationVersion = instance._version, @@ -750,6 +758,7 @@ export function SimListInstance(version: V1): SimListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/wireless/v1/sim/dataSession.ts b/src/rest/wireless/v1/sim/dataSession.ts index 59009e5e90..af6a320921 100644 --- a/src/rest/wireless/v1/sim/dataSession.ts +++ b/src/rest/wireless/v1/sim/dataSession.ts @@ -176,6 +176,7 @@ export function DataSessionListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/wireless/v1/sim/usageRecord.ts b/src/rest/wireless/v1/sim/usageRecord.ts index a6ff238652..1477ad2a2a 100644 --- a/src/rest/wireless/v1/sim/usageRecord.ts +++ b/src/rest/wireless/v1/sim/usageRecord.ts @@ -202,6 +202,7 @@ export function UsageRecordListInstance( if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/rest/wireless/v1/usageRecord.ts b/src/rest/wireless/v1/usageRecord.ts index 810f6506e5..937d050e91 100644 --- a/src/rest/wireless/v1/usageRecord.ts +++ b/src/rest/wireless/v1/usageRecord.ts @@ -193,6 +193,7 @@ export function UsageRecordListInstance(version: V1): UsageRecordListInstance { if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers: any = {}; + headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.page({ diff --git a/src/twiml/VoiceResponse.ts b/src/twiml/VoiceResponse.ts index 38f492cd51..707e80586e 100644 --- a/src/twiml/VoiceResponse.ts +++ b/src/twiml/VoiceResponse.ts @@ -348,6 +348,8 @@ namespace VoiceResponse { type ConversationTrim = "trim-silence" | "do-not-trim"; + type DialEvents = "call-progress-event"; + type DialRecord = | "do-not-record" | "record-from-answer" @@ -1339,6 +1341,8 @@ namespace VoiceResponse { answerOnBridge?: boolean; /** callerId - Caller ID to display */ callerId?: string; + /** events - Subscription to events */ + events?: DialEvents; /** hangupOnStar - Hangup call on star press */ hangupOnStar?: boolean; /** method - Action URL method */ @@ -1657,6 +1661,8 @@ namespace VoiceResponse { hints?: string; /** inboundTrackLabel - Friendly name given to the Inbound Track */ inboundTrackLabel?: string; + /** intelligenceService - The SID or the unique name of the Intelligence Service to be used */ + intelligenceService?: string; /** languageCode - Language Code used by the transcription engine */ languageCode?: string; /** name - Friendly name given to the Transcription */ @@ -1763,6 +1769,8 @@ namespace VoiceResponse { hints?: string; /** inboundTrackLabel - Friendly name given to the Inbound Track */ inboundTrackLabel?: string; + /** intelligenceService - The SID or the unique name of the Intelligence Service to be used */ + intelligenceService?: string; /** languageCode - Language Code used by the transcription engine */ languageCode?: string; /** name - Friendly name given to the Transcription */ @@ -2663,6 +2671,134 @@ namespace VoiceResponse { url?: string; } + /** + * Attributes to pass to conversationRelay + */ + export interface ConversationRelayAttributes { + /** debug - Whether debugging on the session is enabled */ + debug?: boolean; + /** dtmfDetection - Whether DTMF tones should be detected and reported in speech transcription */ + dtmfDetection?: boolean; + /** interruptByDtmf - Whether DTMF tone can interrupt the play of text-to-speech */ + interruptByDtmf?: boolean; + /** interruptible - Whether caller's speaking can interrupt the play of text-to-speech */ + interruptible?: boolean; + /** language - Language to be used for both text-to-speech and transcription */ + language?: string; + /** partialPrompts - Whether partial prompts should be reported to WebSocket server before the caller finishes speaking */ + partialPrompts?: boolean; + /** profanityFilter - Whether profanities should be filtered out of the speech transcription */ + profanityFilter?: boolean; + /** speechModel - Speech model to be used for transcription */ + speechModel?: string; + /** transcriptionLanguage - Language to be used for transcription */ + transcriptionLanguage?: string; + /** transcriptionProvider - Provider to be used for transcription */ + transcriptionProvider?: string; + /** ttsLanguage - Language to be used for text-to-speech */ + ttsLanguage?: string; + /** ttsProvider - Provider to be used for text-to-speech */ + ttsProvider?: string; + /** url - URL of the remote service where the session is connected to */ + url?: string; + /** voice - Voice to be used for text-to-speech */ + voice?: string; + /** welcomeGreeting - The sentence to be played automatically when the session is connected */ + welcomeGreeting?: string; + /** welcomeGreetingInterruptible - Whether caller's speaking can interrupt the welcome greeting */ + welcomeGreetingInterruptible?: boolean; + } + + /** + * Attributes to pass to assistant + */ + export interface AssistantAttributes { + /** debug - Whether debugging on the session is enabled */ + debug?: boolean; + /** dtmfDetection - Whether DTMF tones should be detected and reported in speech transcription */ + dtmfDetection?: boolean; + /** id - The assistant ID of the AI Assistant */ + id?: string; + /** interruptByDtmf - Whether DTMF tone can interrupt the play of text-to-speech */ + interruptByDtmf?: boolean; + /** interruptible - Whether caller's speaking can interrupt the play of text-to-speech */ + interruptible?: boolean; + /** language - Language to be used for both text-to-speech and transcription */ + language?: string; + /** partialPrompts - Whether partial prompts should be reported to WebSocket server before the caller finishes speaking */ + partialPrompts?: boolean; + /** profanityFilter - Whether profanities should be filtered out of the speech transcription */ + profanityFilter?: boolean; + /** speechModel - Speech model to be used for transcription */ + speechModel?: string; + /** transcriptionLanguage - Language to be used for transcription */ + transcriptionLanguage?: string; + /** transcriptionProvider - Provider to be used for transcription */ + transcriptionProvider?: string; + /** ttsLanguage - Language to be used for text-to-speech */ + ttsLanguage?: string; + /** ttsProvider - Provider to be used for text-to-speech */ + ttsProvider?: string; + /** voice - Voice to be used for text-to-speech */ + voice?: string; + /** welcomeGreeting - The sentence to be played automatically when the session is connected */ + welcomeGreeting?: string; + /** welcomeGreetingInterruptible - Whether caller's speaking can interrupt the welcome greeting */ + welcomeGreetingInterruptible?: boolean; + } + + /** + * Attributes to pass to language + */ + export interface LanguageAttributes { + /** code - Language code of this language setting is for */ + code?: string; + /** speechModel - Speech model to be used for transcription of this language */ + speechModel?: string; + /** transcriptionProvider - Provider to be used for transcription of this language */ + transcriptionProvider?: string; + /** ttsProvider - Provider to be used for text-to-speech of this language */ + ttsProvider?: string; + /** voice - Voice to be used for text-to-speech of this language */ + voice?: string; + } + + /** + * Attributes to pass to parameter + */ + export interface ParameterAttributes { + /** name - The name of the custom parameter */ + name?: string; + /** value - The value of the custom parameter */ + value?: string; + } + + /** + * Attributes to pass to language + */ + export interface LanguageAttributes { + /** code - Language code of this language setting is for */ + code?: string; + /** speechModel - Speech model to be used for transcription of this language */ + speechModel?: string; + /** transcriptionProvider - Provider to be used for transcription of this language */ + transcriptionProvider?: string; + /** ttsProvider - Provider to be used for text-to-speech of this language */ + ttsProvider?: string; + /** voice - Voice to be used for text-to-speech of this language */ + voice?: string; + } + + /** + * Attributes to pass to parameter + */ + export interface ParameterAttributes { + /** name - The name of the custom parameter */ + name?: string; + /** value - The value of the custom parameter */ + value?: string; + } + /** * Attributes to pass to config */ @@ -2742,6 +2878,42 @@ namespace VoiceResponse { } } + export class Assistant extends TwiML { + assistant: XMLElement; + /** + * TwiML Noun + */ + constructor(assistant: XMLElement) { + super(); + this.assistant = assistant; + this._propertyName = "assistant"; + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + language( + attributes?: VoiceResponse.LanguageAttributes + ): VoiceResponse.Language { + return new VoiceResponse.Language( + this.assistant.ele("Language", attributes) + ); + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + parameter( + attributes?: VoiceResponse.ParameterAttributes + ): VoiceResponse.Parameter { + return new VoiceResponse.Parameter( + this.assistant.ele("Parameter", attributes) + ); + } + } + export class Autopilot extends TwiML { autopilot: XMLElement; /** @@ -2835,6 +3007,18 @@ namespace VoiceResponse { this.connect = connect; this._propertyName = "connect"; } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + assistant( + attributes?: VoiceResponse.AssistantAttributes + ): VoiceResponse.Assistant { + return new VoiceResponse.Assistant( + this.connect.ele("Assistant", attributes) + ); + } /** * TwiML Noun * @@ -2867,6 +3051,18 @@ namespace VoiceResponse { this.connect.ele("Conversation", attributes) ); } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + conversationRelay( + attributes?: VoiceResponse.ConversationRelayAttributes + ): VoiceResponse.ConversationRelay { + return new VoiceResponse.ConversationRelay( + this.connect.ele("ConversationRelay", attributes) + ); + } /** * TwiML Noun * @@ -2922,6 +3118,42 @@ namespace VoiceResponse { } } + export class ConversationRelay extends TwiML { + conversationRelay: XMLElement; + /** + * TwiML Noun + */ + constructor(conversationRelay: XMLElement) { + super(); + this.conversationRelay = conversationRelay; + this._propertyName = "conversationRelay"; + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + language( + attributes?: VoiceResponse.LanguageAttributes + ): VoiceResponse.Language { + return new VoiceResponse.Language( + this.conversationRelay.ele("Language", attributes) + ); + } + /** + * TwiML Noun + * + * @param attributes - TwiML attributes + */ + parameter( + attributes?: VoiceResponse.ParameterAttributes + ): VoiceResponse.Parameter { + return new VoiceResponse.Parameter( + this.conversationRelay.ele("Parameter", attributes) + ); + } + } + export class Dial extends TwiML { dial: XMLElement; /** @@ -3226,6 +3458,18 @@ namespace VoiceResponse { } } + export class Language extends TwiML { + language: XMLElement; + /** + * TwiML Noun + */ + constructor(language: XMLElement) { + super(); + this.language = language; + this._propertyName = "language"; + } + } + export class Leave extends TwiML { leave: XMLElement; /**