From 1275a8144e797daf659a0e3f71af6bea4b859c74 Mon Sep 17 00:00:00 2001 From: Lucas Rosa Date: Thu, 10 Oct 2024 17:47:48 -0300 Subject: [PATCH] fix nested resources logic --- CHANGELOG.md | 9 + VERSION | 2 +- package-lock.json | 4 +- package.json | 2 +- src/TelnyxResource.ts | 5 +- src/resources/AutorespConfigs.ts | 13 - src/resources/Brands.ts | 2 +- src/resources/Calls.ts | 14 +- src/resources/Conferences.ts | 75 ++-- src/resources/MessagingProfiles.ts | 118 +++-- src/telnyx.ts | 2 - src/test/resources/Calls.test.ts | 40 +- src/test/resources/Conferences.test.ts | 64 ++- src/test/resources/MessagingProfiles.test.ts | 440 +++++++++++++++---- types/AutorespConfigsResource.d.ts | 74 ---- types/BrandsResource.d.ts | 52 +-- types/CallsResource.d.ts | 224 ++++++++-- types/ChannelzonesResource.d.ts | 20 +- types/ConferencesResource.d.ts | 118 ++++- types/MessagingProfilesResource.d.ts | 138 +++++- types/index.d.ts | 2 - 21 files changed, 1045 insertions(+), 373 deletions(-) delete mode 100644 src/resources/AutorespConfigs.ts delete mode 100644 types/AutorespConfigsResource.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0206dca..54a6b53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ## v2 +### v2.0.0-alpha.8 + +- Move `AutorespConfigs` resource to be nested in `MessagingProfiles` +- Fix nested resources in `Calls`, `MessagingProfiles` and `Conferences` ID usage instead of using constructors data +- Fix nested resources `Calls`, `MessagingProfiles` and `Conferences` method names +- Fix `Brand` resources method name +- Fix bug on `DELETE` operations empty `responseBody` JSON Parsing +- Update types on resources methods with multiple urlParams + ### v2.0.0-alpha.7 - Export API callback `events` type definitions diff --git a/VERSION b/VERSION index f6b05cc..c20cf85 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0-alpha.7 +2.0.0-alpha.8 diff --git a/package-lock.json b/package-lock.json index 72e78ab..7ce2423 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "telnyx", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "telnyx", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "license": "MIT", "devDependencies": { "@eslint/js": "^9.10.0", diff --git a/package.json b/package.json index d0b05ba..8ad0238 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "telnyx", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "description": "Telnyx API Node SDK", "keywords": [ "telnyx", diff --git a/src/TelnyxResource.ts b/src/TelnyxResource.ts index 1516402..af5cec2 100644 --- a/src/TelnyxResource.ts +++ b/src/TelnyxResource.ts @@ -195,7 +195,10 @@ TelnyxResource.prototype = { try { responseBody = utils.tryParseJSON(response); - if (responseBody.errors) { + // JSON response might be empty on deletion operations + if (!responseBody) { + responseBody = {}; + } else if (responseBody.errors) { const error = {} as TelnyxError.TelnyxRawError; error.errors = diff --git a/src/resources/AutorespConfigs.ts b/src/resources/AutorespConfigs.ts deleted file mode 100644 index ae460c0..0000000 --- a/src/resources/AutorespConfigs.ts +++ /dev/null @@ -1,13 +0,0 @@ -import TelnyxResource from '../TelnyxResource'; -const telnyxMethod = TelnyxResource.method; - -export const AutorespConfigs = TelnyxResource.extend({ - path: 'messaging_profiles/{profile_id}/autoresp_configs', - includeBasic: ['del', 'list', 'create', 'retrieve'], - - update: telnyxMethod({ - method: 'PUT', - path: '/{autoresp_cfg_id}', - urlParams: ['profile_id', 'autoresp_cfg_id'], - }), -}); diff --git a/src/resources/Brands.ts b/src/resources/Brands.ts index f1f299c..dfdc025 100644 --- a/src/resources/Brands.ts +++ b/src/resources/Brands.ts @@ -37,7 +37,7 @@ export const Brands = TelnyxResource.extend({ methodType: 'list', }), - exportExternalVettings: telnyxMethod({ + importExternalVettings: telnyxMethod({ method: 'PUT', path: '/brand/{brandId}/externalVetting', urlParams: ['brandId'], diff --git a/src/resources/Calls.ts b/src/resources/Calls.ts index b0f11a9..affdec3 100644 --- a/src/resources/Calls.ts +++ b/src/resources/Calls.ts @@ -34,12 +34,24 @@ const CALL_COMMANDS = [ ]; function getSpec(callControlId?: string) { + if (callControlId) { + return function (methodName: string) { + return { + method: 'POST', + path: `/{call_control_id}/actions/${methodName}`, + urlParams: ['call_control_id'], + paramsValues: [callControlId], + paramsNames: ['call_control_id'], + methodType: 'create', + }; + }; + } + return function (methodName: string) { return { method: 'POST', path: `/{call_control_id}/actions/${methodName}`, urlParams: ['call_control_id'], - paramsValues: [callControlId as string], paramsNames: ['call_control_id'], methodType: 'create', }; diff --git a/src/resources/Conferences.ts b/src/resources/Conferences.ts index 1640f17..007d879 100644 --- a/src/resources/Conferences.ts +++ b/src/resources/Conferences.ts @@ -1,8 +1,9 @@ import TelnyxResource from '../TelnyxResource'; +import {ResponsePayload, TelnyxObject} from '../Types'; import * as utils from '../utils'; const telnyxMethod = TelnyxResource.method; -const CONFERENCES = [ +const CONFERENCES_COMMANDS = [ 'join', 'mute', 'unmute', @@ -20,18 +21,54 @@ const CONFERENCES = [ ]; function getSpec(conferenceId?: string) { + if (conferenceId) { + return function (methodName: string) { + return { + method: 'POST', + path: `/{conferenceId}/actions/${methodName}`, + urlParams: ['conferenceId'], + paramsValues: [conferenceId], + paramsNames: ['conferenceId'], + methodType: 'create', + }; + }; + } + return function (methodName: string) { return { method: 'POST', path: `/{conferenceId}/actions/${methodName}`, urlParams: ['conferenceId'], - paramsValues: [conferenceId as string], - paramsNames: ['id'], + paramsNames: ['conferenceId'], methodType: 'create', }; }; } +const transformResponseData = ( + response: ResponsePayload, + telnyx: TelnyxObject, +) => { + const methods = utils.createNestedMethods( + telnyxMethod, + CONFERENCES_COMMANDS, + getSpec(response.data.id as string), + ); + + methods.listParticipants = telnyxMethod({ + method: 'GET', + path: '/{conferenceId}/participants', + urlParams: ['conferenceId'], + }); + + return utils.addResourceToResponseData( + response, + telnyx, + 'conferences', + methods, + ); +}; + export const Conferences = TelnyxResource.extend({ path: 'conferences', includeBasic: ['list'], @@ -40,39 +77,15 @@ export const Conferences = TelnyxResource.extend({ method: 'GET', path: '/{id}', urlParams: ['id'], - - transformResponseData: function (response, telnyx) { - return utils.addResourceToResponseData( - response, - telnyx, - 'conferences', - utils.createNestedMethods( - telnyxMethod, - CONFERENCES, - getSpec(response.data.id as string), - ), - ); - }, + transformResponseData: transformResponseData, }), create: telnyxMethod({ method: 'POST', - - transformResponseData: function (response, telnyx) { - return utils.addResourceToResponseData( - response, - telnyx, - 'conferences', - utils.createNestedMethods( - telnyxMethod, - CONFERENCES, - getSpec(response.data.id as string), - ), - ); - }, + transformResponseData: transformResponseData, }), - participants: telnyxMethod({ + listParticipants: telnyxMethod({ method: 'GET', path: '/{conferenceId}/participants', urlParams: ['conferenceId'], @@ -80,7 +93,7 @@ export const Conferences = TelnyxResource.extend({ instanceMethods: utils.createNestedMethods( telnyxMethod, - CONFERENCES, + CONFERENCES_COMMANDS, getSpec(), ), }); diff --git a/src/resources/MessagingProfiles.ts b/src/resources/MessagingProfiles.ts index cbeaf08..78b80f9 100644 --- a/src/resources/MessagingProfiles.ts +++ b/src/resources/MessagingProfiles.ts @@ -1,11 +1,11 @@ -import telnyx from 'telnyx'; +import Telnyx from 'telnyx'; import TelnyxResource from '../TelnyxResource'; import {ResponsePayload, TelnyxObject} from '../Types'; import * as utils from '../utils'; const telnyxMethod = TelnyxResource.method; -const ACTIONS = ['phone_numbers', 'short_codes', 'metrics', 'autoresp_configs']; +const MESSAGING_PROFILES_COMMANDS = ['phone_numbers', 'short_codes']; function getSpec(messagingProfileId?: string) { return function (methodName: string) { @@ -14,19 +14,19 @@ function getSpec(messagingProfileId?: string) { path: `/{messagingProfileId}/${methodName}`, urlParams: ['messagingProfileId'], paramsValues: [messagingProfileId as string], - paramsNames: ['id'], + paramsNames: ['messagingProfileId'], methodType: 'list', }; }; } const transformResponseData = ( - response: ResponsePayload, + response: ResponsePayload, telnyx: TelnyxObject, ) => { const methods = utils.createNestedMethods( telnyxMethod, - ACTIONS, + MESSAGING_PROFILES_COMMANDS, getSpec(response.data.id as string), ); @@ -35,7 +35,59 @@ const transformResponseData = ( path: '/{messagingProfileId}', urlParams: ['messagingProfileId'], paramsValues: [response.data.id as string], - paramsNames: ['id'], + paramsNames: ['messagingProfileId'], + }); + + methods.listAutorespConfigs = telnyxMethod({ + method: 'GET', + path: '/{profileId}/autoresp_configs', + urlParams: ['profileId'], + paramsValues: [response.data.id as string], + paramsNames: ['profileId'], + methodType: 'list', + }); + + methods.createAutorespConfig = telnyxMethod({ + method: 'POST', + path: '/{profileId}/autoresp_configs', + urlParams: ['profileId'], + paramsValues: [response.data.id as string], + paramsNames: ['profileId'], + methodType: 'create', + }); + + methods.delAutorespConfig = telnyxMethod({ + method: 'DELETE', + path: '/{profileId}/autoresp_configs/{autorespCfgId}', + paramsValues: [response.data.id as string], + urlParams: ['profileId', 'autorespCfgId'], + paramsNames: ['profileId', 'autorespCfgId'], + }); + + methods.retrieveAutorespConfig = telnyxMethod({ + method: 'GET', + path: '/{profileId}/autoresp_configs/{autorespCfgId}', + paramsValues: [response.data.id as string], + urlParams: ['profileId', 'autorespCfgId'], + paramsNames: ['profileId', 'autorespCfgId'], + methodType: 'retrieve', + }); + + methods.updateAutorespConfig = telnyxMethod({ + method: 'PUT', + path: '/{profileId}/autoresp_configs/{autorespCfgId}', + paramsValues: [response.data.id as string], + urlParams: ['profileId', 'autorespCfgId'], + paramsNames: ['profileId', 'autorespCfgId'], + }); + + methods.retrieveMetrics = telnyxMethod({ + method: 'GET', + path: '/{messagingProfileId}/metrics', + urlParams: ['messagingProfileId'], + paramsValues: [response.data.id as string], + paramsNames: ['messagingProfileId'], + methodType: 'retrieve', }); return utils.addResourceToResponseData( @@ -70,12 +122,6 @@ export const MessagingProfiles = TelnyxResource.extend({ methodType: 'list', }), - phoneNumbers: telnyxMethod({ - method: 'GET', - path: '/{messagingProfileId}/phone_numbers', - urlParams: ['messagingProfileId'], - }), - listShortCodes: telnyxMethod({ method: 'GET', path: '/{messagingProfileId}/short_codes', @@ -83,30 +129,48 @@ export const MessagingProfiles = TelnyxResource.extend({ methodType: 'list', }), - shortCodes: telnyxMethod({ + listAutorespConfigs: telnyxMethod({ method: 'GET', - path: '/{messagingProfileId}/short_codes', - urlParams: ['messagingProfileId'], + path: '/{profileId}/autoresp_configs', + urlParams: ['profileId'], + paramsNames: ['profileId'], + methodType: 'list', }), - retrieveMetrics: telnyxMethod({ + createAutorespConfig: telnyxMethod({ + method: 'POST', + path: '/{profileId}/autoresp_configs', + urlParams: ['profileId'], + paramsNames: ['profileId'], + methodType: 'create', + }), + + delAutorespConfig: telnyxMethod({ + method: 'DELETE', + path: '/{profileId}/autoresp_configs/{autorespCfgId}', + urlParams: ['profileId', 'autorespCfgId'], + paramsNames: ['profileId', 'autorespCfgId'], + }), + + retrieveAutorespConfig: telnyxMethod({ method: 'GET', - path: '/{messagingProfileId}/metrics', - urlParams: ['messagingProfileId'], + path: '/{profileId}/autoresp_configs/{autorespCfgId}', + urlParams: ['profileId', 'autorespCfgId'], + paramsNames: ['profileId', 'autorespCfgId'], methodType: 'retrieve', }), - autorespConfigs: telnyxMethod({ - method: 'GET', - path: '/{messagingProfileId}/autoresp_configs', - urlParams: ['messagingProfileId'], - methodType: 'list', + updateAutorespConfig: telnyxMethod({ + method: 'PUT', + path: '/{profileId}/autoresp_configs/{autorespCfgId}', + urlParams: ['profileId', 'autorespCfgId'], + paramsNames: ['profileId', 'autorespCfgId'], }), - listAutorespConfigs: telnyxMethod({ + retrieveMetrics: telnyxMethod({ method: 'GET', - path: '/{messagingProfileId}/autoresp_configs', - urlParams: ['messagingProfileId'], - methodType: 'list', + path: '/{id}/metrics', + urlParams: ['id'], + methodType: 'retrieve', }), }); diff --git a/src/telnyx.ts b/src/telnyx.ts index f1bf253..783bae9 100644 --- a/src/telnyx.ts +++ b/src/telnyx.ts @@ -12,7 +12,6 @@ import {Actions} from './resources/Actions'; import {ActionsSimCards} from './resources/ActionsSimCards'; import {ActivateDeactivateBulkCredentials} from './resources/ActivateDeactivateBulkCredentials'; import {Addresses} from './resources/Addresses'; -import {AutorespConfigs} from './resources/AutorespConfigs'; import {AiAssistants} from './resources/AiAssistants'; import {AiAudioTranscriptions} from './resources/AiAudioTranscriptions'; import {AiChatCompletions} from './resources/AiChatCompletions'; @@ -184,7 +183,6 @@ export function createTelnyx() { ActionsSimCards, ActivateDeactivateBulkCredentials, Addresses, - AutorespConfigs, AiAssistants, AiAudioTranscriptions, AiChatCompletions, diff --git a/src/test/resources/Calls.test.ts b/src/test/resources/Calls.test.ts index 247b964..3dae75a 100644 --- a/src/test/resources/Calls.test.ts +++ b/src/test/resources/Calls.test.ts @@ -225,7 +225,7 @@ describe('Calls Resource', function () { telnyxInstance = testUtils.getTelnyxMock(); }); - test('Sends the correct request', function () { + test('Sends the correct request [nested]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyxInstance.calls .create(callCreateData) @@ -243,7 +243,8 @@ describe('Calls Resource', function () { ); }); }); - test('Sends the correct request [with specified auth]', function () { + + test('Sends the correct request [nested with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyxInstance.calls .create(callCreateData) @@ -263,43 +264,30 @@ describe('Calls Resource', function () { }); }); - test('Sends the correct method request [with empty resource instance]', async function () { - // @ts-expect-error TODO: import .d.ts files under src/test folder - const call = new telnyxInstance.Call({ - call_control_id: '3fa85f55-5717-4562-b3fc-2c963f63vga6', - }); - + test('Sends the correct method request [without resource instance]', async function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - await call[utils.snakeToCamelCase(command)]( + return telnyxInstance.calls[utils.snakeToCamelCase(command)]( + '3fa85f55-5717-4562-b3fc-2c963f63vga6', callCommandsData[command] || {'': ''}, // need to pass string due to telnyx mock parse ).then(responseFn); - - // @ts-expect-error TODO: import .d.ts files under src/test folder - return call[utils.snakeToCamelCase(command)]( - callCommandsData[command] || {'': ''}, // need to pass string due to telnyx mock parse - TEST_AUTH_KEY, - ).then(responseFn); }); - test('Sends the correct method request [with empty resource instance and specified auth]', async function () { - // @ts-expect-error TODO: import .d.ts files under src/test folder - const call = new telnyxInstance.Call({ - call_control_id: '3fa85f55-5717-4562-b3fc-2c963f63vga6', - }); - + test('Sends the correct method request [without resource instance and specified auth]', async function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - await call[command]( + return telnyxInstance.calls[command]( + '3fa85f55-5717-4562-b3fc-2c963f63vga6', callCommandsData[command] || {'': ''}, // need to pass string due to telnyx mock parse TEST_AUTH_KEY, ).then(responseFn); - // @ts-expect-error TODO: import .d.ts files under src/test folder - return call[command](callCommandsData[command] || {'': ''}).then( - responseFn, - ); }); if (camelCaseCommand !== command) { describe(camelCaseCommand, function () { + beforeEach(() => { + // make specs independent + telnyxInstance = testUtils.getTelnyxMock(); + }); + test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyxInstance.calls.create(callCreateData).then(function ( diff --git a/src/test/resources/Conferences.test.ts b/src/test/resources/Conferences.test.ts index b275da2..4c472ea 100644 --- a/src/test/resources/Conferences.test.ts +++ b/src/test/resources/Conferences.test.ts @@ -43,7 +43,7 @@ describe('Call Conferences', function () { }, speak: { language: 'en-US', - payload: 'Say this to participants', + payload: 'Say this to listParticipants', voice: 'female', }, play: { @@ -129,7 +129,7 @@ describe('Call Conferences', function () { }); }); - describe('participants', function () { + describe('listParticipants', function () { function responseFn(response: ResponsePayloadList) { expect(response.data[0]).toMatchObject({ record_type: 'participant', @@ -144,16 +144,42 @@ describe('Call Conferences', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyx.conferences - .participants(CONFERENCE_ID, {filter: {muted: true}}) + .listParticipants(CONFERENCE_ID, {filter: {muted: true}}) .then(responseFn); }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyx.conferences - .participants(CONFERENCE_ID, TEST_AUTH_KEY) + .listParticipants(CONFERENCE_ID, TEST_AUTH_KEY) .then(responseFn); }); + + test('Sends the correct request [nested without resource instance]', function () { + return telnyx.conferences.retrieve(CONFERENCE_ID).then(function ( + response: ResponsePayload, + ) { + const conference = response.data; + + // @ts-expect-error TODO: import .d.ts files under src/test folder + return conference + .listParticipants({filter: {muted: true}}) + .then(responseFn); + }); + }); + + test('Sends the correct request [nested without resource instance with specified auth]', function () { + return telnyx.conferences.retrieve(CONFERENCE_ID).then(function ( + response: ResponsePayload, + ) { + const conference = response.data; + + // @ts-expect-error TODO: import .d.ts files under src/test folder + return conference + .listParticipants({filter: {muted: true}}, TEST_AUTH_KEY) + .then(responseFn); + }); + }); }); CONFERENCES.forEach(function (action) { @@ -165,7 +191,7 @@ describe('Call Conferences', function () { telnyxInstance = testUtils.getTelnyxMock(); }); - test('Sends the correct request', function () { + test('Sends the correct request [nested]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyxInstance.conferences .create(conferenceCreateData) @@ -177,39 +203,33 @@ describe('Call Conferences', function () { ).then(responseFn); }); }); - test('Sends the correct request [with specified auth]', function () { + test('Sends the correct request [nested with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder return telnyxInstance.conferences .create(conferenceCreateData) .then(function (response: ResponsePayload) { const conference = response.data; + // // @ts-expect-error TODO: import .d.ts files under src/test folder return conference[action]( - // // @ts-expect-error TODO: import .d.ts files under src/test folder callConferencesData[action] || {'': ''}, // need to pass string due to telnyx mock parse TEST_AUTH_KEY, ).then(responseFn); }); }); - test('Sends the correct request [with empty resource instance]', function () { - // @ts-expect-error TODO: import .d.ts files under src/test folder - const conference = new telnyxInstance.Conference({ - id: '891510ac-f3e4-11e8-af5b-de00688a4901', - }); - - return conference[action](callConferencesData[action] || {'': ''}).then( + test('Sends the correct request [without resource instance]', function () { + return telnyxInstance.conferences[action]( + '891510ac-f3e4-11e8-af5b-de00688a4901', + callConferencesData[action] || {'': ''}, + ).then( // need to pass string due to telnyx mock parse responseFn, ); }); - test('Sends the correct request [with empty resource instance and specified auth]', function () { - // @ts-expect-error TODO: import .d.ts files under src/test folder - const conference = new telnyxInstance.Conference({ - id: '891510ac-f3e4-11e8-af5b-de00688a4901', - }); - - return conference[action]( - // // @ts-expect-error TODO: import .d.ts files under src/test folder + test('Sends the correct request [without resource instance and specified auth]', function () { + // // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.conferences[action]( + '891510ac-f3e4-11e8-af5b-de00688a4901', callConferencesData[action] || {'': ''}, // need to pass string due to telnyx mock parse TEST_AUTH_KEY, ).then(responseFn); diff --git a/src/test/resources/MessagingProfiles.test.ts b/src/test/resources/MessagingProfiles.test.ts index aeb5775..4a489ed 100644 --- a/src/test/resources/MessagingProfiles.test.ts +++ b/src/test/resources/MessagingProfiles.test.ts @@ -9,8 +9,6 @@ import { } from '../utils'; import * as utils from '../../utils'; -const telnyx = testUtils.getTelnyxMock(); - const TEST_AUTH_KEY = 'KEY187557EC22404DB39975C43ACE661A58_9QdDI7XD5bvyahtaWx1YQo'; const TEST_UUID = '123e4567-e89b-12d3-a456-426614174000'; @@ -27,12 +25,25 @@ type ResponsePayloadMetrics = { }; type ResponsePayloadAutorespConfig = { + data: { + id: string; + }[]; +}; + +type ResponsePayloadCreateAutorespConfig = { data: { id: string; }; }; describe('MessagingProfiles Resource', function () { + let telnyxInstance: TelnyxObject; + + beforeEach(() => { + // make specs independent + telnyxInstance = testUtils.getTelnyxMock(); + }); + function responseFn(response: ResponsePayload) { expect(response.data).toHaveProperty('name'); expect(response.data).toMatchObject({record_type: 'messaging_profile'}); @@ -47,7 +58,7 @@ describe('MessagingProfiles Resource', function () { describe('retrieve', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .retrieve(TEST_UUID) .then(responseFn) .catch(errorFn); @@ -55,7 +66,7 @@ describe('MessagingProfiles Resource', function () { test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .retrieve(TEST_UUID, TEST_AUTH_KEY) .then(responseFn) .catch(errorFn); @@ -65,7 +76,7 @@ describe('MessagingProfiles Resource', function () { describe('create', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create({name: 'Summer Campaign', whitelisted_destinations: ['US']}) .then(responseFn) .catch(errorFn); @@ -73,7 +84,7 @@ describe('MessagingProfiles Resource', function () { test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create( {name: 'Summer Campaign', whitelisted_destinations: ['US']}, TEST_AUTH_KEY, @@ -84,7 +95,7 @@ describe('MessagingProfiles Resource', function () { test('Sends the correct request [with specified auth in options]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create( {name: 'Summer Campaign', whitelisted_destinations: ['US']}, {api_key: TEST_AUTH_KEY}, @@ -97,7 +108,7 @@ describe('MessagingProfiles Resource', function () { describe('update', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .update(TEST_UUID, {name: 'Foo "baz"'}) .then(responseFn) .catch(errorFn); @@ -115,12 +126,15 @@ describe('MessagingProfiles Resource', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles.list().then(responseFn).catch(errorFn); + return telnyxInstance.messagingProfiles + .list() + .then(responseFn) + .catch(errorFn); }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .list(TEST_AUTH_KEY) .then(responseFn) .catch(errorFn); @@ -140,16 +154,16 @@ describe('MessagingProfiles Resource', function () { describe('listPhoneNumbers', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .listPhoneNumbers(TEST_UUID) + return telnyxInstance.messagingProfiles + .listPhoneNumbers(TEST_UUID, {}) .then(responseFn) .catch(errorFn); }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .listPhoneNumbers(TEST_UUID, TEST_AUTH_KEY) + return telnyxInstance.messagingProfiles + .listPhoneNumbers(TEST_UUID, {}, TEST_AUTH_KEY) .then(responseFn) .catch(errorFn); }); @@ -167,16 +181,16 @@ describe('MessagingProfiles Resource', function () { describe('listShortCodes', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .listShortCodes(TEST_UUID) + return telnyxInstance.messagingProfiles + .listShortCodes(TEST_UUID, {}) .then(responseFn) .catch(errorFn); }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .listShortCodes(TEST_UUID, TEST_AUTH_KEY) + return telnyxInstance.messagingProfiles + .listShortCodes(TEST_UUID, {}, TEST_AUTH_KEY) .then(responseFn) .catch(errorFn); }); @@ -200,7 +214,7 @@ describe('MessagingProfiles Resource', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create({name: 'Summer Campaign', whitelisted_destinations: ['US']}) .then(function (response: ResponsePayload) { const mp = response.data; @@ -210,7 +224,7 @@ describe('MessagingProfiles Resource', function () { }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create({name: 'Summer Campaign', whitelisted_destinations: ['US']}) .then(function (response: ResponsePayload) { const mp = response.data; @@ -223,7 +237,7 @@ describe('MessagingProfiles Resource', function () { describe(camelCaseAction, function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create({ name: 'Summer Campaign', whitelisted_destinations: ['US'], @@ -237,7 +251,7 @@ describe('MessagingProfiles Resource', function () { }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles + return telnyxInstance.messagingProfiles .create({ name: 'Summer Campaign', whitelisted_destinations: ['US'], @@ -254,110 +268,368 @@ describe('MessagingProfiles Resource', function () { }); }); }); + }); - describe('Metrics methods', function () { - function metricsNestedResponseFn(response: ResponsePayloadMetrics) { - expect(response.data).toHaveProperty('detailed'); - expect(response.data).toHaveProperty('overview'); - expect(response.data.overview).toHaveProperty('inbound'); - expect(response.data.overview).toHaveProperty('outbound'); - expect(response.data.overview).toHaveProperty('phone_numbers'); - expect(response.data.overview).toHaveProperty('messaging_profile_id'); - expect(response.data.overview).toMatchObject({ - record_type: 'messaging_profile_metrics', - }); - expect(response.data.detailed[0]).toHaveProperty('metrics'); - } + describe('Metrics methods', function () { + function metricsNestedResponseFn(response: ResponsePayloadMetrics) { + expect(response.data).toHaveProperty('detailed'); + expect(response.data).toHaveProperty('overview'); + expect(response.data.overview).toHaveProperty('inbound'); + expect(response.data.overview).toHaveProperty('outbound'); + expect(response.data.overview).toHaveProperty('phone_numbers'); + expect(response.data.overview).toHaveProperty('messaging_profile_id'); + expect(response.data.overview).toMatchObject({ + record_type: 'messaging_profile_metrics', + }); + expect(response.data.detailed[0]).toHaveProperty('metrics'); + } + + describe('retrieveMetrics', function () { + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .retrieveMetrics(TEST_UUID, {}) + .then(metricsNestedResponseFn); + }); - describe('retrieveMetrics', function () { + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .retrieveMetrics(TEST_UUID, {}, TEST_AUTH_KEY) + .then(metricsNestedResponseFn); + }); + }); + + describe('nested metrics', function () { + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .create({name: 'Summer Campaign', whitelisted_destinations: ['US']}) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp.retrieveMetrics({}).then(metricsNestedResponseFn); + }); + }); + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .retrieve(TEST_UUID) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .retrieveMetrics({}, TEST_AUTH_KEY) + .then(metricsNestedResponseFn); + }); + }); + }); + }); + + describe('AutorespConfigs methods', function () { + function autorespConfigNestedResponseFn( + response: ResponsePayloadAutorespConfig, + ) { + expect(response.data[0]).toHaveProperty('country_code'); + expect(response.data[0]).toHaveProperty('resp_text'); + expect(response.data[0]).toHaveProperty('keywords'); + expect(response.data[0]).toHaveProperty('op'); + expect(response.data[0]).toHaveProperty('id'); + } + + function autorespConfigCreatedNestedResponseFn( + response: ResponsePayloadCreateAutorespConfig, + ) { + expect(response.data).toHaveProperty('country_code'); + expect(response.data).toHaveProperty('resp_text'); + expect(response.data).toHaveProperty('keywords'); + expect(response.data).toHaveProperty('op'); + expect(response.data).toHaveProperty('id'); + } + + describe('listAutorespConfigs', function () { + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .listAutorespConfigs(TEST_UUID, {}) + .then(autorespConfigNestedResponseFn); + }); + + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .listAutorespConfigs(TEST_UUID, {}, TEST_AUTH_KEY) + .then(autorespConfigNestedResponseFn); + }); + + describe('nested listAutorespConfigs', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .retrieveMetrics(TEST_UUID) - .then(metricsNestedResponseFn); + return telnyxInstance.messagingProfiles + .create({ + name: 'Summer Campaign', + whitelisted_destinations: ['US'], + }) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .listAutorespConfigs() + .then(autorespConfigNestedResponseFn); + }); }); - test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .retrieveMetrics(TEST_UUID, TEST_AUTH_KEY) - .then(metricsNestedResponseFn); + return telnyxInstance.messagingProfiles + .retrieve(TEST_UUID) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .listAutorespConfigs(TEST_AUTH_KEY) + .then(autorespConfigNestedResponseFn); + }); }); }); + }); + + describe('createAutorespConfig', function () { + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .createAutorespConfig(TEST_UUID, { + op: 'start', + keywords: ['test'], + country_code: 'US', + }) + .then(autorespConfigCreatedNestedResponseFn); + }); + + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .createAutorespConfig( + TEST_UUID, + { + op: 'start', + keywords: ['test'], + country_code: 'US', + }, + TEST_AUTH_KEY, + ) + .then(autorespConfigCreatedNestedResponseFn); + }); - describe('nested metrics', function () { + describe('nested createAutorespConfig', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .create({name: 'Summer Campaign', whitelisted_destinations: ['US']}) + return telnyxInstance.messagingProfiles + .create({ + name: 'Summer Campaign', + whitelisted_destinations: ['US'], + }) .then(function (response: ResponsePayload) { const mp = response.data; // @ts-expect-error TODO: import .d.ts files under src/test folder - return mp.metrics().then(metricsNestedResponseFn); + return mp + .createAutorespConfig({ + op: 'start', + keywords: ['test'], + country_code: 'US', + }) + .then(autorespConfigCreatedNestedResponseFn); }); }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles.retrieve(TEST_UUID).then(function ( - response: ResponsePayload, - ) { - const mp = response.data; - // @ts-expect-error TODO: import .d.ts files under src/test folder - return mp.metrics(TEST_AUTH_KEY).then(metricsNestedResponseFn); - }); + return telnyxInstance.messagingProfiles + .retrieve(TEST_UUID) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .createAutorespConfig( + { + op: 'start', + keywords: ['test'], + country_code: 'US', + }, + TEST_AUTH_KEY, + ) + .then(autorespConfigCreatedNestedResponseFn); + }); }); }); }); - describe('AutorespConfigs methods', function () { - function autorespConfigNestedResponseFn( - response: ResponsePayloadAutorespConfig, - ) { - expect(response.data[0]).toHaveProperty('country_code'); - expect(response.data[0]).toHaveProperty('resp_text'); - expect(response.data[0]).toHaveProperty('keywords'); - expect(response.data[0]).toHaveProperty('op'); - expect(response.data[0]).toHaveProperty('id'); - } + describe('retrieveAutorespConfig', function () { + const autoResponseConfigId = '123e4567-e89b-12d3-a456-000014179999'; + + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .retrieveAutorespConfig(TEST_UUID, autoResponseConfigId) + .then(autorespConfigCreatedNestedResponseFn); + }); + + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .retrieveAutorespConfig( + TEST_UUID, + autoResponseConfigId, + TEST_AUTH_KEY, + ) + .then(autorespConfigCreatedNestedResponseFn); + }); - describe('autorespConfigs', function () { + describe('nested retrieveAutorespConfig', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .listAutorespConfigs(TEST_UUID) - .then(autorespConfigNestedResponseFn); + return telnyxInstance.messagingProfiles + .create({ + name: 'Summer Campaign', + whitelisted_destinations: ['US'], + }) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .retrieveAutorespConfig(autoResponseConfigId) + .then(autorespConfigCreatedNestedResponseFn); + }); + }); + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .retrieve(TEST_UUID) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .retrieveAutorespConfig(autoResponseConfigId, TEST_AUTH_KEY) + .then(autorespConfigCreatedNestedResponseFn); + }); }); + }); + }); + + describe('delAutorespConfig', function () { + const autoResponseConfigId = '123e4567-e89b-12d3-a456-000014179999'; + + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles.delAutorespConfig( + TEST_UUID, + autoResponseConfigId, + ); + }); + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles.delAutorespConfig( + TEST_UUID, + autoResponseConfigId, + TEST_AUTH_KEY, + ); + }); + + describe('nested delAutorespConfig', function () { + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .create({ + name: 'Summer Campaign', + whitelisted_destinations: ['US'], + }) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp.delAutorespConfig(autoResponseConfigId); + }); + }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .listAutorespConfigs(TEST_UUID, TEST_AUTH_KEY) - .then(autorespConfigNestedResponseFn); + return telnyxInstance.messagingProfiles + .retrieve(TEST_UUID) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp.delAutorespConfig(autoResponseConfigId, TEST_AUTH_KEY); + }); }); }); + }); + + describe('updateAutorespConfig', function () { + const autoResponseConfigId = '123e4567-e89b-12d3-a456-000014179999'; - describe('nested autoresp_configs', function () { + test('Sends the correct request', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .updateAutorespConfig(TEST_UUID, autoResponseConfigId, { + op: 'start', + keywords: ['test'], + country_code: 'US', + }) + .then(autorespConfigCreatedNestedResponseFn); + }); + + test('Sends the correct request [with specified auth]', function () { + // @ts-expect-error TODO: import .d.ts files under src/test folder + return telnyxInstance.messagingProfiles + .updateAutorespConfig( + TEST_UUID, + autoResponseConfigId, + { + op: 'start', + keywords: ['test'], + country_code: 'US', + }, + TEST_AUTH_KEY, + ) + .then(autorespConfigCreatedNestedResponseFn); + }); + + describe('nested updateAutorespConfig', function () { test('Sends the correct request', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles - .create({name: 'Summer Campaign', whitelisted_destinations: ['US']}) + return telnyxInstance.messagingProfiles + .create({ + name: 'Summer Campaign', + whitelisted_destinations: ['US'], + }) .then(function (response: ResponsePayload) { const mp = response.data; // @ts-expect-error TODO: import .d.ts files under src/test folder - return mp.autorespConfigs().then(autorespConfigNestedResponseFn); + return mp + .updateAutorespConfig(autoResponseConfigId, { + op: 'start', + keywords: ['test'], + country_code: 'US', + }) + .then(autorespConfigCreatedNestedResponseFn); }); }); test('Sends the correct request [with specified auth]', function () { // @ts-expect-error TODO: import .d.ts files under src/test folder - return telnyx.messagingProfiles.retrieve(TEST_UUID).then(function ( - response: ResponsePayload, - ) { - const mp = response.data; - // @ts-expect-error TODO: import .d.ts files under src/test folder - return mp - .autorespConfigs(TEST_AUTH_KEY) - .then(autorespConfigNestedResponseFn); - }); + return telnyxInstance.messagingProfiles + .retrieve(TEST_UUID) + .then(function (response: ResponsePayload) { + const mp = response.data; + // @ts-expect-error TODO: import .d.ts files under src/test folder + return mp + .updateAutorespConfig( + autoResponseConfigId, + { + op: 'start', + keywords: ['test'], + country_code: 'US', + }, + TEST_AUTH_KEY, + ) + .then(autorespConfigCreatedNestedResponseFn); + }); }); }); }); diff --git a/types/AutorespConfigsResource.d.ts b/types/AutorespConfigsResource.d.ts deleted file mode 100644 index 6f145ee..0000000 --- a/types/AutorespConfigsResource.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -import {paths} from './TelnyxAPI.js'; - -declare module 'telnyx' { - namespace Telnyx { - type AutorespConfigsRetrievePathParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['get']['parameters']['path']; - - type AutorespConfigsRetrieveResponse = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['get']['responses']['200']['content']['application/json']; - - type AutorespConfigsCreatePathParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs']['post']['parameters']['path']; - - type AutorespConfigsCreateParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs']['post']['requestBody']['content']['application/json']; - - type AutorespConfigsCreateResponse = - paths['/messaging_profiles/{profile_id}/autoresp_configs']['post']['responses']['200']['content']['application/json']; - - type AutorespConfigsListPathParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs']['get']['parameters']['path']; - - type AutorespConfigsListParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs']['get']['parameters']['query']; - - type AutorespConfigsListResponse = - paths['/messaging_profiles/{profile_id}/autoresp_configs']['get']['responses']['200']['content']['application/json']; - - type AutorespConfigsDelPathParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['delete']['parameters']['path']; - - type AutorespConfigsDelResponse = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['delete']['responses']['200']['content']['application/json']; - - type AutorespConfigsUpdatePathParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['parameters']['path']; - - type AutorespConfigsUpdateParams = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['requestBody']['content']['application/json']; - - type AutorespConfigsUpdateResponse = - paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['responses']['200']['content']['application/json']; - - class AutorespConfigsResource { - retrieve( - params: AutorespConfigsRetrievePathParams, - options?: RequestOptions, - ): Promise>; - - create( - pathParams: AutorespConfigsCreatePathParams, - params: AutorespConfigsCreateParams, - options?: RequestOptions, - ): Promise>; - - list( - pathParams: AutorespConfigsListPathParams, - params?: AutorespConfigsListParams, - options?: RequestOptions, - ): Promise>; - - del( - params: AutorespConfigsDelPathParams, - options?: RequestOptions, - ): Promise>; - - update( - pathParams: AutorespConfigsUpdatePathParams, - params: AutorespConfigsUpdateParams, - options?: RequestOptions, - ): Promise>; - } - } -} diff --git a/types/BrandsResource.d.ts b/types/BrandsResource.d.ts index 5bad56c..2f8c288 100644 --- a/types/BrandsResource.d.ts +++ b/types/BrandsResource.d.ts @@ -40,29 +40,29 @@ declare module 'telnyx' { type BrandsUpdateResponse = paths['/brand/{brandId}']['put']['responses']['200']['content']['application/json']; - type BrandsResend2faEmailPathParams = - paths['/brand/{brandId}/2faEmail']['post']['parameters']['path']; + type BrandsResend2faEmailId = + paths['/brand/{brandId}/2faEmail']['post']['parameters']['path']['brandId']; type BrandsResend2faEmailResponse = paths['/brand/{brandId}/2faEmail']['post']['responses']['200']['content']; - type BrandsListExternalVettingsPathParams = - paths['/brand/{brandId}/externalVetting']['get']['parameters']['path']; + type BrandsListExternalVettingsId = + paths['/brand/{brandId}/externalVetting']['get']['parameters']['path']['brandId']; type BrandsListExternalVettingsResponse = paths['/brand/{brandId}/externalVetting']['get']['responses']['200']['content']['application/json']; - type BrandsExportExternalVettingsPathParams = - paths['/brand/{brandId}/externalVetting']['put']['parameters']['path']; + type BrandsImportExternalVettingsId = + paths['/brand/{brandId}/externalVetting']['put']['parameters']['path']['brandId']; - type BrandsExportExternalVettingsParams = + type BrandsImportExternalVettingsParams = paths['/brand/{brandId}/externalVetting']['put']['requestBody']['content']['application/json']; - type BrandsExportExternalVettingsResponse = + type BrandsImportExternalVettingsResponse = paths['/brand/{brandId}/externalVetting']['put']['responses']['200']['content']['application/json']; - type BrandsOrderExternalVettingsPathParams = - paths['/brand/{brandId}/externalVetting']['post']['parameters']['path']; + type BrandsOrderExternalVettingsId = + paths['/brand/{brandId}/externalVetting']['post']['parameters']['path']['brandId']; type BrandsOrderExternalVettingsParams = paths['/brand/{brandId}/externalVetting']['post']['requestBody']['content']['application/json']; @@ -70,8 +70,8 @@ declare module 'telnyx' { type BrandsOrderExternalVettingsResponse = paths['/brand/{brandId}/externalVetting']['post']['responses']['200']['content']['application/json']; - type BrandsRevetPathParams = - paths['/brand/{brandId}/revet']['put']['parameters']['path']; + type BrandsRevetid = + paths['/brand/{brandId}/revet']['put']['parameters']['path']['brandId']; type BrandsRevetParams = paths['/brand/{brandId}/externalVetting']['put']['requestBody']['content']['application/json']; @@ -79,10 +79,10 @@ declare module 'telnyx' { type BrandsRevetResponse = paths['/brand/{brandId}/revet']['put']['responses']['200']['content']['application/json']; - type BrandsFeedbackPathParams = - paths['/brand/feedback/{brandId}']['get']['parameters']['path']; + type BrandsFeedbackRetrieveId = + paths['/brand/feedback/{brandId}']['get']['parameters']['path']['brandId']; - type BrandsFeedbackResponse = + type BrandsFeedbackRetrieveResponse = paths['/brand/feedback/{brandId}']['get']['responses']['200']['content']['application/json']; class BrandsResource { @@ -113,37 +113,37 @@ declare module 'telnyx' { ): Promise>; resend2faEmail( - pathParams: BrandsResend2faEmailPathParams, + id: BrandsResend2faEmailId, options?: RequestOptions, ): Promise>; listExternalVettings( - pathParams: BrandsListExternalVettingsPathParams, + id: BrandsListExternalVettingsId, options?: RequestOptions, ): Promise>; - exportExternalVettings( - pathParams: BrandsExportExternalVettingsPathParams, - params: BrandsExportExternalVettingsParams, + importExternalVettings( + id: BrandsImportExternalVettingsId, + params: BrandsImportExternalVettingsParams, options?: RequestOptions, - ): Promise>; + ): Promise>; orderExternalVettings( - pathParams: BrandsOrderExternalVettingsPathParams, + id: BrandsOrderExternalVettingsId, params: BrandsOrderExternalVettingsParams, options?: RequestOptions, ): Promise>; revet( - pathParams: BrandsRevetPathParams, + id: BrandsRevetid, params: BrandsRevetParams, options?: RequestOptions, ): Promise>; - feedback( - pathParams: BrandsFeedbackPathParams, + retrieveFeedback( + id: BrandsFeedbackRetrieveId, options?: RequestOptions, - ): Promise>; + ): Promise>; } } } diff --git a/types/CallsResource.d.ts b/types/CallsResource.d.ts index 05d7b6a..b5c064f 100644 --- a/types/CallsResource.d.ts +++ b/types/CallsResource.d.ts @@ -17,60 +17,116 @@ declare module 'telnyx' { type CallsCreateResponse = paths['/calls']['post']['responses']['200']['content']['application/json']; + type CallsAnswerId = + paths['/calls/{call_control_id}/actions/answer']['post']['parameters']['path']['call_control_id']; type CallsAnswerParams = paths['/calls/{call_control_id}/actions/answer']['post']['requestBody']['content']['application/json']; + type CallsRejectId = + paths['/calls/{call_control_id}/actions/reject']['post']['parameters']['path']['call_control_id']; type CallsRejectParams = paths['/calls/{call_control_id}/actions/reject']['post']['requestBody']['content']['application/json']; + type CallsHangupId = + paths['/calls/{call_control_id}/actions/hangup']['post']['parameters']['path']['call_control_id']; type CallsHangupParams = paths['/calls/{call_control_id}/actions/hangup']['post']['requestBody']['content']['application/json']; + type CallsBridgeId = + paths['/calls/{call_control_id}/actions/bridge']['post']['parameters']['path']['call_control_id']; type CallsBridgeParams = paths['/calls/{call_control_id}/actions/bridge']['post']['requestBody']['content']['application/json']; + type CallsSpeakId = + paths['/calls/{call_control_id}/actions/speak']['post']['parameters']['path']['call_control_id']; type CallsSpeakParams = paths['/calls/{call_control_id}/actions/speak']['post']['requestBody']['content']['application/json']; + type CallsForkStartId = + paths['/calls/{call_control_id}/actions/fork_start']['post']['parameters']['path']['call_control_id']; type CallsForkStartParams = paths['/calls/{call_control_id}/actions/fork_start']['post']['requestBody']['content']['application/json']; + type CallsForkStopId = + paths['/calls/{call_control_id}/actions/fork_stop']['post']['parameters']['path']['call_control_id']; type CallsForkStopParams = paths['/calls/{call_control_id}/actions/fork_stop']['post']['requestBody']['content']['application/json']; + type CallsGatherId = + paths['/calls/{call_control_id}/actions/gather']['post']['parameters']['path']['call_control_id']; type CallsGatherParams = paths['/calls/{call_control_id}/actions/gather']['post']['requestBody']['content']['application/json']; + type CallsGatherUsingAudioId = + paths['/calls/{call_control_id}/actions/gather_using_audio']['post']['parameters']['path']['call_control_id']; type CallsGatherUsingAudioParams = paths['/calls/{call_control_id}/actions/gather_using_audio']['post']['requestBody']['content']['application/json']; + type CallsGatherUsingSpeakId = + paths['/calls/{call_control_id}/actions/gather_using_speak']['post']['parameters']['path']['call_control_id']; type CallsGatherUsingSpeakParams = paths['/calls/{call_control_id}/actions/gather_using_speak']['post']['requestBody']['content']['application/json']; + type CallsGatherStopId = + paths['/calls/{call_control_id}/actions/gather_stop']['post']['parameters']['path']['call_control_id']; type CallsGatherStopParams = paths['/calls/{call_control_id}/actions/gather_stop']['post']['requestBody']['content']['application/json']; + type CallsPlaybackStartId = + paths['/calls/{call_control_id}/actions/playback_start']['post']['parameters']['path']['call_control_id']; type CallsPlaybackStartParams = paths['/calls/{call_control_id}/actions/playback_start']['post']['requestBody']['content']['application/json']; + type CallsPlaybackStopId = + paths['/calls/{call_control_id}/actions/playback_stop']['post']['parameters']['path']['call_control_id']; type CallsPlaybackStopParams = paths['/calls/{call_control_id}/actions/playback_stop']['post']['requestBody']['content']['application/json']; + type CallsRecordStartId = + paths['/calls/{call_control_id}/actions/record_start']['post']['parameters']['path']['call_control_id']; type CallsRecordStartParams = paths['/calls/{call_control_id}/actions/record_start']['post']['requestBody']['content']['application/json']; + type CallsRecordStopId = + paths['/calls/{call_control_id}/actions/record_stop']['post']['parameters']['path']['call_control_id']; type CallsRecordStopParams = paths['/calls/{call_control_id}/actions/record_stop']['post']['requestBody']['content']['application/json']; + type CallsRecordPauseId = + paths['/calls/{call_control_id}/actions/record_pause']['post']['parameters']['path']['call_control_id']; type CallsRecordPauseParams = paths['/calls/{call_control_id}/actions/record_pause']['post']['requestBody']['content']['application/json']; + type CallsRecordResumeId = + paths['/calls/{call_control_id}/actions/record_resume']['post']['parameters']['path']['call_control_id']; type CallsRecordResumeParams = paths['/calls/{call_control_id}/actions/record_resume']['post']['requestBody']['content']['application/json']; + type CallsReferId = + paths['/calls/{call_control_id}/actions/refer']['post']['parameters']['path']['call_control_id']; type CallsReferParams = paths['/calls/{call_control_id}/actions/refer']['post']['requestBody']['content']['application/json']; + type CallsSendDtmfId = + paths['/calls/{call_control_id}/actions/send_dtmf']['post']['parameters']['path']['call_control_id']; type CallsSendDtmfParams = paths['/calls/{call_control_id}/actions/send_dtmf']['post']['requestBody']['content']['application/json']; + type CallsStreamingStartId = + paths['/calls/{call_control_id}/actions/streaming_start']['post']['parameters']['path']['call_control_id']; type CallsStreamingStartParams = paths['/calls/{call_control_id}/actions/streaming_start']['post']['requestBody']['content']['application/json']; + type CallsStreamingStopId = + paths['/calls/{call_control_id}/actions/streaming_stop']['post']['parameters']['path']['call_control_id']; type CallsStreamingStopParams = paths['/calls/{call_control_id}/actions/streaming_stop']['post']['requestBody']['content']['application/json']; + type CallsSuppressionStartId = + paths['/calls/{call_control_id}/actions/suppression_start']['post']['parameters']['path']['call_control_id']; type CallsSuppressionStartParams = paths['/calls/{call_control_id}/actions/suppression_start']['post']['requestBody']['content']['application/json']; + type CallsSuppressionStopId = + paths['/calls/{call_control_id}/actions/suppression_stop']['post']['parameters']['path']['call_control_id']; type CallsSuppressionStopParams = paths['/calls/{call_control_id}/actions/suppression_stop']['post']['requestBody']['content']['application/json']; + type CallsTransferId = + paths['/calls/{call_control_id}/actions/transfer']['post']['parameters']['path']['call_control_id']; type CallsTransferParams = paths['/calls/{call_control_id}/actions/transfer']['post']['requestBody']['content']['application/json']; + type CallsTranscriptionStartId = + paths['/calls/{call_control_id}/actions/transcription_start']['post']['parameters']['path']['call_control_id']; type CallsTranscriptionStartParams = paths['/calls/{call_control_id}/actions/transcription_start']['post']['requestBody']['content']['application/json']; + type CallsTranscriptionStopId = + paths['/calls/{call_control_id}/actions/transcription_stop']['post']['parameters']['path']['call_control_id']; type CallsTranscriptionStopParams = paths['/calls/{call_control_id}/actions/transcription_stop']['post']['requestBody']['content']['application/json']; + type CallsEnqueueId = + paths['/calls/{call_control_id}/actions/enqueue']['post']['parameters']['path']['call_control_id']; type CallsEnqueueParams = paths['/calls/{call_control_id}/actions/enqueue']['post']['requestBody']['content']['application/json']; + type CallsLeaveQueueId = + paths['/calls/{call_control_id}/actions/leave_queue']['post']['parameters']['path']['call_control_id']; type CallsLeaveQueueParams = paths['/calls/{call_control_id}/actions/leave_queue']['post']['requestBody']['content']['application/json']; @@ -132,34 +188,118 @@ declare module 'telnyx' { paths['/calls/{call_control_id}/actions/leave_queue']['post']['responses']['200']['content']['application/json']; type CallsNestedMethods = { - answer: CallsResource['answer']; - reject: CallsResource['reject']; - hangup: CallsResource['hangup']; - bridge: CallsResource['bridge']; - speak: CallsResource['speak']; - forkStart: CallsResource['forkStart']; - forkStop: CallsResource['forkStop']; - gather: CallsResource['gather']; - gatherUsingAudio: CallsResource['gatherUsingAudio']; - gatherUsingSpeak: CallsResource['gatherUsingSpeak']; - gatherStop: CallsResource['gatherStop']; - playbackStart: CallsResource['playbackStart']; - playbackStop: CallsResource['playbackStop']; - recordStart: CallsResource['recordStart']; - recordStop: CallsResource['recordStop']; - recordPause: CallsResource['recordPause']; - recordResume: CallsResource['recordResume']; - refer: CallsResource['refer']; - sendDtmf: CallsResource['sendDtmf']; - streamingStart: CallsResource['streamingStart']; - streamingStop: CallsResource['streamingStop']; - suppressionStart: CallsResource['suppressionStart']; - suppressionStop: CallsResource['suppressionStop']; - transfer: CallsResource['transfer']; - transcriptionStart: CallsResource['transcriptionStart']; - transcriptionStop: CallsResource['transcriptionStop']; - enqueue: CallsResource['enqueue']; - leaveQueue: CallsResource['leaveQueue']; + answer( + params: CallsAnswerParams, + options?: RequestOptions, + ): Promise>; + reject( + params: CallsRejectParams, + options?: RequestOptions, + ): Promise>; + hangup( + params: CallsHangupParams, + options?: RequestOptions, + ): Promise>; + bridge( + params: CallsBridgeParams, + options?: RequestOptions, + ): Promise>; + speak( + params: CallsSpeakParams, + options?: RequestOptions, + ): Promise>; + forkStart( + params: CallsForkStartParams, + options?: RequestOptions, + ): Promise>; + forkStop( + params: CallsForkStopParams, + options?: RequestOptions, + ): Promise>; + gather( + params: CallsGatherParams, + options?: RequestOptions, + ): Promise>; + gatherUsingAudio( + params: CallsGatherUsingAudioParams, + options?: RequestOptions, + ): Promise>; + gatherUsingSpeak( + params: CallsGatherUsingSpeakParams, + options?: RequestOptions, + ): Promise>; + gatherStop( + params: CallsGatherStopParams, + options?: RequestOptions, + ): Promise>; + playbackStart( + params: CallsPlaybackStartParams, + options?: RequestOptions, + ): Promise>; + playbackStop( + params: CallsPlaybackStopParams, + options?: RequestOptions, + ): Promise>; + recordStart( + params: CallsRecordStartParams, + options?: RequestOptions, + ): Promise>; + recordStop( + params: CallsRecordStopParams, + options?: RequestOptions, + ): Promise>; + recordPause( + params: CallsRecordPauseParams, + options?: RequestOptions, + ): Promise>; + recordResume( + params: CallsRecordResumeParams, + options?: RequestOptions, + ): Promise>; + refer( + params: CallsReferParams, + options?: RequestOptions, + ): Promise>; + sendDtmf( + params: CallsSendDtmfParams, + options?: RequestOptions, + ): Promise>; + streamingStart( + params: CallsStreamingStartParams, + options?: RequestOptions, + ): Promise>; + streamingStop( + params: CallsStreamingStopParams, + options?: RequestOptions, + ): Promise>; + suppressionStart( + params: CallsSuppressionStartParams, + options?: RequestOptions, + ): Promise>; + suppressionStop( + params: CallsSuppressionStopParams, + options?: RequestOptions, + ): Promise>; + transfer( + params: CallsTransferParams, + options?: RequestOptions, + ): Promise>; + transcriptionStart( + params: CallsTranscriptionStartParams, + options?: RequestOptions, + ): Promise>; + transcriptionStop( + params: CallsTranscriptionStopParams, + options?: RequestOptions, + ): Promise>; + enqueue( + params: CallsEnqueueParams, + options?: RequestOptions, + ): Promise>; + leaveQueue( + params: CallsLeaveQueueParams, + options?: RequestOptions, + ): Promise>; }; class CallsResource { @@ -189,114 +329,142 @@ declare module 'telnyx' { >; answer( + id: CallsAnswerId, params: CallsAnswerParams, options?: RequestOptions, ): Promise>; reject( + id: CallsRejectId, params: CallsRejectParams, options?: RequestOptions, ): Promise>; hangup( + id: CallsHangupId, params: CallsHangupParams, options?: RequestOptions, ): Promise>; bridge( + id: CallsBridgeId, params: CallsBridgeParams, options?: RequestOptions, ): Promise>; speak( + id: CallsSpeakId, params: CallsSpeakParams, options?: RequestOptions, ): Promise>; forkStart( + id: CallsForkStartId, params: CallsForkStartParams, options?: RequestOptions, ): Promise>; forkStop( + id: CallsForkStopId, params: CallsForkStopParams, options?: RequestOptions, ): Promise>; gather( + id: CallsGatherId, params: CallsGatherParams, options?: RequestOptions, ): Promise>; gatherUsingAudio( + id: CallsGatherUsingAudioId, params: CallsGatherUsingAudioParams, options?: RequestOptions, ): Promise>; gatherUsingSpeak( + id: CallsGatherUsingSpeakId, params: CallsGatherUsingSpeakParams, options?: RequestOptions, ): Promise>; gatherStop( + id: CallsGatherStopId, params: CallsGatherStopParams, options?: RequestOptions, ): Promise>; playbackStart( + id: CallsPlaybackStartId, params: CallsPlaybackStartParams, options?: RequestOptions, ): Promise>; playbackStop( + id: CallsPlaybackStopId, params: CallsPlaybackStopParams, options?: RequestOptions, ): Promise>; recordStart( + id: CallsRecordStartId, params: CallsRecordStartParams, options?: RequestOptions, ): Promise>; recordStop( + id: CallsRecordStopId, params: CallsRecordStopParams, options?: RequestOptions, ): Promise>; recordPause( + id: CallsRecordPauseId, params: CallsRecordPauseParams, options?: RequestOptions, ): Promise>; recordResume( + id: CallsRecordResumeId, params: CallsRecordResumeParams, options?: RequestOptions, ): Promise>; refer( + id: CallsReferId, params: CallsReferParams, options?: RequestOptions, ): Promise>; sendDtmf( + id: CallsSendDtmfId, params: CallsSendDtmfParams, options?: RequestOptions, ): Promise>; streamingStart( + id: CallsStreamingStartId, params: CallsStreamingStartParams, options?: RequestOptions, ): Promise>; streamingStop( + id: CallsStreamingStopId, params: CallsStreamingStopParams, options?: RequestOptions, ): Promise>; suppressionStart( + id: CallsSuppressionStartId, params: CallsSuppressionStartParams, options?: RequestOptions, ): Promise>; suppressionStop( + id: CallsSuppressionStopId, params: CallsSuppressionStopParams, options?: RequestOptions, ): Promise>; transfer( + id: CallsTransferId, params: CallsTransferParams, options?: RequestOptions, ): Promise>; transcriptionStart( + id: CallsTranscriptionStartId, params: CallsTranscriptionStartParams, options?: RequestOptions, ): Promise>; transcriptionStop( + id: CallsTranscriptionStopId, params: CallsTranscriptionStopParams, options?: RequestOptions, ): Promise>; enqueue( + id: CallsEnqueueId, params: CallsEnqueueParams, options?: RequestOptions, ): Promise>; leaveQueue( + id: CallsLeaveQueueId, params: CallsLeaveQueueParams, options?: RequestOptions, ): Promise>; diff --git a/types/ChannelzonesResource.d.ts b/types/ChannelzonesResource.d.ts index b4e7e65..ec12b21 100644 --- a/types/ChannelzonesResource.d.ts +++ b/types/ChannelzonesResource.d.ts @@ -26,7 +26,7 @@ declare module 'telnyx' { type ChannelzonesRetrieveResponse = paths['/channel_zones/{channel_zone_id}']['get']['responses']['200']['content']['application/json']; - type ChannelzonesPhoneNumbersListId = + type ChannelzonesPhoneNumbersListChannelzoneId = paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers']['get']['parameters']['path']['channel_zone_id']; type ChannelzonesPhoneNumbersListParams = @@ -35,8 +35,8 @@ declare module 'telnyx' { type ChannelzonesPhoneNumbersListResponse = paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers']['get']['responses']['200']['content']['application/json']; - type ChannelzonesPhoneNumbersCreatePathParams = - paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers']['post']['parameters']['path']; + type ChannelzonesPhoneNumbersCreateChannelZoneId = + paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers']['post']['parameters']['path']['channel_zone_id']; type ChannelzonesPhoneNumbersCreateParams = paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers']['post']['requestBody']['content']['application/json']; @@ -44,8 +44,11 @@ declare module 'telnyx' { type ChannelzonesPhoneNumbersCreateResponse = paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers']['post']['responses']['200']['content']['application/json']; - type ChannelzonesPhoneNumbersDeletePathParams = - paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers/{phone_number}']['delete']['parameters']['path']; + type ChannelzonesPhoneNumbersDeleteChannelzoneId = + paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers/{phone_number}']['delete']['parameters']['path']['channel_zone_id']; + + type ChannelzonesPhoneNumbersDeletePhoneNumber = + paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers/{phone_number}']['delete']['parameters']['path']['phone_number']; type ChannelzonesPhoneNumbersDeleteResponse = paths['/channel_zones/{channel_zone_id}/channel_zone_phone_numbers/{phone_number}']['delete']['responses']['200']['content']; @@ -68,13 +71,13 @@ declare module 'telnyx' { ): Promise>; listPhoneNumbers( - id: ChannelzonesPhoneNumbersListId, + id: ChannelzonesPhoneNumbersListChannelzoneId, params?: ChannelzonesPhoneNumbersListParams, options?: RequestOptions, ): Promise>; createPhoneNumber( - pathParams: ChannelzonesPhoneNumbersCreatePathParams, + id: ChannelzonesPhoneNumbersCreateChannelZoneId, params: ChannelzonesPhoneNumbersCreateParams, options?: RequestOptions, ): Promise< @@ -82,7 +85,8 @@ declare module 'telnyx' { >; delPhoneNumber( - pathParams: ChannelzonesPhoneNumbersDeletePathParams, + id: ChannelzonesPhoneNumbersDeleteChannelzoneId, + phoneNumber: ChannelzonesPhoneNumbersDeletePhoneNumber, options?: RequestOptions, ): Promise< Telnyx.Response diff --git a/types/ConferencesResource.d.ts b/types/ConferencesResource.d.ts index c1d6a06..39988ec 100644 --- a/types/ConferencesResource.d.ts +++ b/types/ConferencesResource.d.ts @@ -23,32 +23,60 @@ declare module 'telnyx' { type ConferencesCreateResponse = paths['/conferences']['post']['responses']['200']['content']['application/json']; + type ConferencesJoinId = + paths['/conferences/{id}/actions/join']['post']['parameters']['path']['id']; type ConferencesJoinParams = paths['/conferences/{id}/actions/join']['post']['requestBody']['content']['application/json']; + type ConferencesMuteId = + paths['/conferences/{id}/actions/mute']['post']['parameters']['path']['id']; type ConferencesMuteParams = paths['/conferences/{id}/actions/mute']['post']['responses']['200']['content']['application/json']; + type ConferencesUnmuteId = + paths['/conferences/{id}/actions/unmute']['post']['parameters']['path']['id']; type ConferencesUnmuteParams = paths['/conferences/{id}/actions/unmute']['post']['responses']['200']['content']['application/json']; + type ConferencesHoldId = + paths['/conferences/{id}/actions/hold']['post']['parameters']['path']['id']; type ConferencesHoldParams = paths['/conferences/{id}/actions/hold']['post']['responses']['200']['content']['application/json']; + type ConferencesUnholdId = + paths['/conferences/{id}/actions/unhold']['post']['parameters']['path']['id']; type ConferencesUnholdParams = paths['/conferences/{id}/actions/unhold']['post']['responses']['200']['content']['application/json']; + type ConferencesSpeakId = + paths['/conferences/{id}/actions/speak']['post']['parameters']['path']['id']; type ConferencesSpeakParams = paths['/conferences/{id}/actions/speak']['post']['responses']['200']['content']['application/json']; + type ConferencesPlayId = + paths['/conferences/{id}/actions/play']['post']['parameters']['path']['id']; type ConferencesPlayParams = paths['/conferences/{id}/actions/play']['post']['responses']['200']['content']['application/json']; + type ConferencesStopId = + paths['/conferences/{id}/actions/stop']['post']['parameters']['path']['id']; type ConferencesStopParams = paths['/conferences/{id}/actions/stop']['post']['responses']['200']['content']['application/json']; + type ConferencesRecordStartId = + paths['/conferences/{id}/actions/record_start']['post']['parameters']['path']['id']; type ConferencesRecordStartParams = paths['/conferences/{id}/actions/record_start']['post']['responses']['200']['content']['application/json']; + type ConferencesRecordStopId = + paths['/conferences/{id}/actions/record_stop']['post']['parameters']['path']['id']; type ConferencesRecordStopParams = paths['/conferences/{id}/actions/record_stop']['post']['responses']['200']['content']['application/json']; + type ConferencesRecordResumeId = + paths['/conferences/{id}/actions/record_resume']['post']['parameters']['path']['id']; type ConferencesRecordResumeParams = paths['/conferences/{id}/actions/record_resume']['post']['responses']['200']['content']['application/json']; + type ConferencesRecordPauseId = + paths['/conferences/{id}/actions/record_pause']['post']['parameters']['path']['id']; type ConferencesRecordPauseParams = paths['/conferences/{id}/actions/record_pause']['post']['responses']['200']['content']['application/json']; + type ConferencesUpdateId = + paths['/conferences/{id}/actions/update']['post']['parameters']['path']['id']; type ConferencesUpdateParams = paths['/conferences/{id}/actions/update']['post']['responses']['200']['content']['application/json']; + type ConferencesLeaveId = + paths['/conferences/{id}/actions/leave']['post']['parameters']['path']['id']; type ConferencesLeaveParams = paths['/conferences/{id}/actions/leave']['post']['responses']['200']['content']['application/json']; @@ -91,20 +119,66 @@ declare module 'telnyx' { paths['/conferences/{id}']['get']['responses']['200']['content']['application/json']; type ConferencesNestedMethods = { - join: ConferencesResource['join']; - mute: ConferencesResource['mute']; - unmute: ConferencesResource['unmute']; - hold: ConferencesResource['hold']; - unhold: ConferencesResource['unhold']; - speak: ConferencesResource['speak']; - play: ConferencesResource['play']; - stop: ConferencesResource['stop']; - recordStart: ConferencesResource['recordStart']; - recordStop: ConferencesResource['recordStop']; - update: ConferencesResource['update']; - leave: ConferencesResource['leave']; - recordResume: ConferencesResource['recordResume']; - recordPause: ConferencesResource['recordPause']; + join( + params: ConferencesJoinParams, + options?: RequestOptions, + ): Promise>; + mute( + params: ConferencesMuteParams, + options?: RequestOptions, + ): Promise>; + unmute( + params: ConferencesUnmuteParams, + options?: RequestOptions, + ): Promise>; + hold( + params: ConferencesHoldParams, + options?: RequestOptions, + ): Promise>; + unhold( + params: ConferencesUnholdParams, + options?: RequestOptions, + ): Promise>; + speak( + params: ConferencesSpeakParams, + options?: RequestOptions, + ): Promise>; + play( + params: ConferencesPlayParams, + options?: RequestOptions, + ): Promise>; + stop( + params: ConferencesStopParams, + options?: RequestOptions, + ): Promise>; + recordStart( + params: ConferencesRecordStartParams, + options?: RequestOptions, + ): Promise>; + recordStop( + params: ConferencesRecordStopParams, + options?: RequestOptions, + ): Promise>; + update( + params: ConferencesUpdateParams, + options?: RequestOptions, + ): Promise>; + leave( + params: ConferencesLeaveParams, + options?: RequestOptions, + ): Promise>; + recordResume( + params: ConferencesRecordResumeParams, + options?: RequestOptions, + ): Promise>; + recordPause( + params: ConferencesRecordPauseParams, + options?: RequestOptions, + ): Promise>; + listParticipants( + params: ConferencesParticipantsParams, + options?: RequestOptions, + ): Promise>; }; class ConferencesResource { @@ -136,63 +210,77 @@ declare module 'telnyx' { >; join( + id: ConferencesJoinId, params: ConferencesJoinParams, options?: RequestOptions, ): Promise>; mute( + id: ConferencesMuteId, params: ConferencesMuteParams, options?: RequestOptions, ): Promise>; unmute( + id: ConferencesUnmuteId, params: ConferencesUnmuteParams, options?: RequestOptions, ): Promise>; hold( + id: ConferencesHoldId, params: ConferencesHoldParams, options?: RequestOptions, ): Promise>; unhold( + id: ConferencesUnholdId, params: ConferencesUnholdParams, options?: RequestOptions, ): Promise>; speak( + id: ConferencesSpeakId, params: ConferencesSpeakParams, options?: RequestOptions, ): Promise>; play( + id: ConferencesPlayId, params: ConferencesPlayParams, options?: RequestOptions, ): Promise>; stop( + id: ConferencesStopId, params: ConferencesStopParams, options?: RequestOptions, ): Promise>; recordStart( + id: ConferencesRecordStartId, params: ConferencesRecordStartParams, options?: RequestOptions, ): Promise>; recordStop( + id: ConferencesRecordStopId, params: ConferencesRecordStopParams, options?: RequestOptions, ): Promise>; update( + id: ConferencesUpdateId, params: ConferencesUpdateParams, options?: RequestOptions, ): Promise>; leave( + id: ConferencesLeaveId, params: ConferencesLeaveParams, options?: RequestOptions, ): Promise>; recordResume( + id: ConferencesRecordResumeId, params: ConferencesRecordResumeParams, options?: RequestOptions, ): Promise>; recordPause( + id: ConferencesRecordPauseId, params: ConferencesRecordPauseParams, options?: RequestOptions, ): Promise>; - participants( + listParticipants( id: ConferencesParticipantsId, params: ConferencesParticipantsParams, options?: RequestOptions, diff --git a/types/MessagingProfilesResource.d.ts b/types/MessagingProfilesResource.d.ts index e3e6aa0..5a11fce 100644 --- a/types/MessagingProfilesResource.d.ts +++ b/types/MessagingProfilesResource.d.ts @@ -41,12 +41,18 @@ declare module 'telnyx' { type MessagingProfilesCreateResponse = paths['/messaging_profiles']['post']['responses']['200']['content']['application/json']; + type MessagingProfilesListPhoneNumbersId = + paths['/messaging_profiles/{id}/phone_numbers']['get']['parameters']['path']['id']; + type MessagingProfilesListPhoneNumbersParams = paths['/messaging_profiles/{id}/phone_numbers']['get']['parameters']['query']; type MessagingProfilesListPhoneNumbersResponse = paths['/messaging_profiles/{id}/phone_numbers']['get']['responses']['200']['content']['application/json']; + type MessagingProfilesListShortCodesId = + paths['/messaging_profiles/{id}/short_codes']['get']['parameters']['path']['id']; + type MessagingProfilesListShortCodesParams = paths['/messaging_profiles/{id}/short_codes']['get']['parameters']['query']; @@ -62,11 +68,84 @@ declare module 'telnyx' { type MessagingProfilesRetrieveMetricsResponse = paths['/messaging_profiles/{id}/metrics']['get']['responses']['200']['content']['application/json']; + type MessagingProfilesListAutorespConfigsId = + paths['/messaging_profiles/{profile_id}/autoresp_configs']['get']['parameters']['path']['profile_id']; + + type MessagingProfilesListAutorespConfigsParams = + paths['/messaging_profiles/{profile_id}/autoresp_configs']['get']['parameters']['query']; + + type MessagingProfilesListAutorespConfigsResponse = + paths['/messaging_profiles/{profile_id}/autoresp_configs']['get']['responses']['200']['content']['application/json']; + + type MessagingProfilesRetrieveAutorespConfigId = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['get']['parameters']['path']['profile_id']; + + type MessagingProfilesRetrieveAutorespConfigAutorespConfigId = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['get']['parameters']['path']['autoresp_cfg_id']; + + type MessagingProfilesRetrieveAutorespConfigResponse = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['get']['responses']['200']['content']['application/json']; + + type MessagingProfilesCreateAutorespConfigsId = + paths['/messaging_profiles/{profile_id}/autoresp_configs']['post']['parameters']['path']['profile_id']; + + type MessagingProfilesCreateAutorespConfigsParams = + paths['/messaging_profiles/{profile_id}/autoresp_configs']['post']['requestBody']['content']['application/json']; + + type MessagingProfilesCreateAutorespConfigsResponse = + paths['/messaging_profiles/{profile_id}/autoresp_configs']['post']['responses']['200']['content']['application/json']; + + type MessagingProfilesDelAutorespConfigId = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['delete']['parameters']['path']['profile_id']; + + type MessagingProfilesDelAutorespConfigAutorespConfigId = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['delete']['parameters']['path']['autoresp_cfg_id']; + + type MessagingProfilesDelAutorespConfigResponse = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['delete']['responses']['200']['content']['application/json']; + + type MessagingProfilesUpdateAutorespConfigId = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['parameters']['path']['profile_id']; + + type MessagingProfilesUpdateAutorespConfigAutorespConfigId = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['parameters']['path']['autoresp_cfg_id']; + + type MessagingProfilesUpdateAutorespConfigParams = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['requestBody']['content']['application/json']; + + type MessagingProfilesUpdateAutorespConfigResponse = + paths['/messaging_profiles/{profile_id}/autoresp_configs/{autoresp_cfg_id}']['put']['responses']['200']['content']['application/json']; + type MessagingProfilesNestedMethods = { del: MessagingProfilesResource['del']; - phoneNumbers: MessagingProfilesResource['listPhoneNumbers']; - shortCodes: MessagingProfilesResource['listShortCodes']; - metrics: MessagingProfilesResource['retrieveMetrics']; + + phoneNumbers( + params: MessagingProfilesListPhoneNumbersParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + shortCodes( + params: MessagingProfilesListShortCodesParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + autorespConfigs( + params: MessagingProfilesListAutorespConfigsParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + retrieveMetrics( + params: MessagingProfilesRetrieveMetricsParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; }; class MessagingProfilesResource { @@ -108,31 +187,74 @@ declare module 'telnyx' { >; list( - params?: MessagingProfilesListParams, + params: MessagingProfilesListParams, options?: RequestOptions, ): Promise>; listPhoneNumbers( - params?: MessagingProfilesListPhoneNumbersParams, + id: MessagingProfilesListPhoneNumbersId, + params: MessagingProfilesListPhoneNumbersParams, options?: RequestOptions, ): Promise< Telnyx.Response >; listShortCodes( - params?: MessagingProfilesListShortCodesParams, + id: MessagingProfilesListShortCodesId, + params: MessagingProfilesListShortCodesParams, options?: RequestOptions, ): Promise< Telnyx.Response >; retrieveMetrics( - id?: MessagingProfilesRetrieveMetricsId, - params?: MessagingProfilesRetrieveMetricsParams, + id: MessagingProfilesRetrieveMetricsId, + params: MessagingProfilesRetrieveMetricsParams, options?: RequestOptions, ): Promise< Telnyx.Response >; + + listAutorespConfigs( + id: MessagingProfilesListAutorespConfigsId, + params: MessagingProfilesListAutorespConfigsParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + createAutorespConfig( + id: MessagingProfilesCreateAutorespConfigsId, + params: MessagingProfilesCreateAutorespConfigsParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + delAutorespConfig( + id: MessagingProfilesDelAutorespConfigId, + autorespConfigId: MessagingProfilesDelAutorespConfigAutorespConfigId, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + retrieveAutorespConfig( + id: MessagingProfilesRetrieveAutorespConfigId, + autorespConfigId: MessagingProfilesRetrieveAutorespConfigAutorespConfigId, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; + + updateAutorespConfig( + id: MessagingProfilesUpdateAutorespConfigId, + autorespConfigId: MessagingProfilesUpdateAutorespConfigAutorespConfigId, + params: MessagingProfilesUpdateAutorespConfigParams, + options?: RequestOptions, + ): Promise< + Telnyx.Response + >; } } } diff --git a/types/index.d.ts b/types/index.d.ts index dfeb8f0..fcb8500 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -20,7 +20,6 @@ /// /// /// -/// /// /// /// @@ -90,7 +89,6 @@ declare module 'telnyx' { accessIpAddress: Telnyx.AccessIpAddressResource; accessIpRanges: Telnyx.AccessIpRangesResource; authenticationProviders: Telnyx.AuthenticationProvidersResource; - autorespConfigs: Telnyx.AutorespConfigsResource; addresses: Telnyx.AddressesResource; availablePhoneNumbers: Telnyx.AvailablePhoneNumbersResource; balance: Telnyx.BalanceResource;