diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 423d234..38f9587 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -9,6 +9,7 @@ api/mfaapi.ts api/phone-number-lookup-api.ts api/recordings-api.ts api/statistics-api.ts +api/transcriptions-api.ts base.ts common.ts configuration.ts @@ -22,6 +23,9 @@ models/call-direction-enum.ts models/call-recording-metadata.ts models/call-state-enum.ts models/call-state.ts +models/call-transcription-metadata.ts +models/call-transcription-response.ts +models/call-transcription.ts models/callback-method-enum.ts models/code-request.ts models/conference-completed-callback.ts @@ -82,6 +86,8 @@ models/priority-enum.ts models/recording-available-callback.ts models/recording-complete-callback.ts models/recording-state-enum.ts +models/recording-transcription-metadata.ts +models/recording-transcriptions.ts models/redirect-callback.ts models/redirect-method-enum.ts models/stir-shaken.ts @@ -89,8 +95,6 @@ models/tag.ts models/tn-lookup-request-error.ts models/transcribe-recording.ts models/transcription-available-callback.ts -models/transcription-list.ts -models/transcription-metadata.ts models/transcription.ts models/transfer-answer-callback.ts models/transfer-complete-callback.ts diff --git a/api.ts b/api.ts index bdb1de2..5e98c2b 100644 --- a/api.ts +++ b/api.ts @@ -22,4 +22,5 @@ export * from './api/messages-api'; export * from './api/phone-number-lookup-api'; export * from './api/recordings-api'; export * from './api/statistics-api'; +export * from './api/transcriptions-api'; diff --git a/api/recordings-api.ts b/api/recordings-api.ts index 67b8ffc..53b45b8 100644 --- a/api/recordings-api.ts +++ b/api/recordings-api.ts @@ -24,9 +24,9 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, ope // @ts-ignore import { CallRecordingMetadata } from '../models'; // @ts-ignore -import { TranscribeRecording } from '../models'; +import { RecordingTranscriptions } from '../models'; // @ts-ignore -import { TranscriptionList } from '../models'; +import { TranscribeRecording } from '../models'; // @ts-ignore import { UpdateCallRecording } from '../models'; // @ts-ignore @@ -38,22 +38,22 @@ import { VoiceApiError } from '../models'; export const RecordingsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** - * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - * @summary Delete Transcription + * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete Recording * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. * @param {string} recordingId Programmable Voice API Recording ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteCallTranscription: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { + deleteRecording: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined - assertParamExists('deleteCallTranscription', 'accountId', accountId) + assertParamExists('deleteRecording', 'accountId', accountId) // verify required parameter 'callId' is not null or undefined - assertParamExists('deleteCallTranscription', 'callId', callId) + assertParamExists('deleteRecording', 'callId', callId) // verify required parameter 'recordingId' is not null or undefined - assertParamExists('deleteCallTranscription', 'recordingId', recordingId) - const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription` + assertParamExists('deleteRecording', 'recordingId', recordingId) + const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"callId"}}`, encodeURIComponent(String(callId))) .replace(`{${"recordingId"}}`, encodeURIComponent(String(recordingId))); @@ -84,22 +84,22 @@ export const RecordingsApiAxiosParamCreator = function (configuration?: Configur }; }, /** - * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - * @summary Delete Recording + * Deletes the specified recording\'s media. + * @summary Delete Recording Media * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. * @param {string} recordingId Programmable Voice API Recording ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteRecording: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { + deleteRecordingMedia: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined - assertParamExists('deleteRecording', 'accountId', accountId) + assertParamExists('deleteRecordingMedia', 'accountId', accountId) // verify required parameter 'callId' is not null or undefined - assertParamExists('deleteRecording', 'callId', callId) + assertParamExists('deleteRecordingMedia', 'callId', callId) // verify required parameter 'recordingId' is not null or undefined - assertParamExists('deleteRecording', 'recordingId', recordingId) - const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}` + assertParamExists('deleteRecordingMedia', 'recordingId', recordingId) + const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"callId"}}`, encodeURIComponent(String(callId))) .replace(`{${"recordingId"}}`, encodeURIComponent(String(recordingId))); @@ -130,22 +130,22 @@ export const RecordingsApiAxiosParamCreator = function (configuration?: Configur }; }, /** - * Deletes the specified recording\'s media. - * @summary Delete Recording Media + * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete Transcription * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. * @param {string} recordingId Programmable Voice API Recording ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteRecordingMedia: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { + deleteRecordingTranscription: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined - assertParamExists('deleteRecordingMedia', 'accountId', accountId) + assertParamExists('deleteRecordingTranscription', 'accountId', accountId) // verify required parameter 'callId' is not null or undefined - assertParamExists('deleteRecordingMedia', 'callId', callId) + assertParamExists('deleteRecordingTranscription', 'callId', callId) // verify required parameter 'recordingId' is not null or undefined - assertParamExists('deleteRecordingMedia', 'recordingId', recordingId) - const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media` + assertParamExists('deleteRecordingTranscription', 'recordingId', recordingId) + const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"callId"}}`, encodeURIComponent(String(callId))) .replace(`{${"recordingId"}}`, encodeURIComponent(String(recordingId))); @@ -268,7 +268,7 @@ export const RecordingsApiAxiosParamCreator = function (configuration?: Configur }; }, /** - * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. * @summary Get Transcription * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. @@ -276,13 +276,13 @@ export const RecordingsApiAxiosParamCreator = function (configuration?: Configur * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getCallTranscription: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { + getRecordingTranscription: async (accountId: string, callId: string, recordingId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined - assertParamExists('getCallTranscription', 'accountId', accountId) + assertParamExists('getRecordingTranscription', 'accountId', accountId) // verify required parameter 'callId' is not null or undefined - assertParamExists('getCallTranscription', 'callId', callId) + assertParamExists('getRecordingTranscription', 'callId', callId) // verify required parameter 'recordingId' is not null or undefined - assertParamExists('getCallTranscription', 'recordingId', recordingId) + assertParamExists('getRecordingTranscription', 'recordingId', recordingId) const localVarPath = `/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"callId"}}`, encodeURIComponent(String(callId))) @@ -523,21 +523,6 @@ export const RecordingsApiAxiosParamCreator = function (configuration?: Configur export const RecordingsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = RecordingsApiAxiosParamCreator(configuration) return { - /** - * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - * @summary Delete Transcription - * @param {string} accountId Your Bandwidth Account ID. - * @param {string} callId Programmable Voice API Call ID. - * @param {string} recordingId Programmable Voice API Recording ID. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteCallTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCallTranscription(accountId, callId, recordingId, options); - const index = configuration?.serverIndex ?? 0; - const operationBasePath = operationServerMap['RecordingsApi.deleteCallTranscription']?.[index]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); - }, /** * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. * @summary Delete Recording @@ -568,6 +553,21 @@ export const RecordingsApiFp = function(configuration?: Configuration) { const operationBasePath = operationServerMap['RecordingsApi.deleteRecordingMedia']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, + /** + * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete Transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} recordingId Programmable Voice API Recording ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteRecordingTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRecordingTranscription(accountId, callId, recordingId, options); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = operationServerMap['RecordingsApi.deleteRecordingTranscription']?.[index]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); + }, /** * Downloads the specified recording. * @summary Download Recording @@ -599,7 +599,7 @@ export const RecordingsApiFp = function(configuration?: Configuration) { return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** - * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. * @summary Get Transcription * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. @@ -607,10 +607,10 @@ export const RecordingsApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getCallTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getCallTranscription(accountId, callId, recordingId, options); + async getRecordingTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getRecordingTranscription(accountId, callId, recordingId, options); const index = configuration?.serverIndex ?? 0; - const operationBasePath = operationServerMap['RecordingsApi.getCallTranscription']?.[index]?.url; + const operationBasePath = operationServerMap['RecordingsApi.getRecordingTranscription']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** @@ -685,18 +685,6 @@ export const RecordingsApiFp = function(configuration?: Configuration) { export const RecordingsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = RecordingsApiFp(configuration) return { - /** - * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - * @summary Delete Transcription - * @param {string} accountId Your Bandwidth Account ID. - * @param {string} callId Programmable Voice API Call ID. - * @param {string} recordingId Programmable Voice API Recording ID. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteCallTranscription(accountId: string, callId: string, recordingId: string, options?: any): AxiosPromise { - return localVarFp.deleteCallTranscription(accountId, callId, recordingId, options).then((request) => request(axios, basePath)); - }, /** * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. * @summary Delete Recording @@ -721,6 +709,18 @@ export const RecordingsApiFactory = function (configuration?: Configuration, bas deleteRecordingMedia(accountId: string, callId: string, recordingId: string, options?: any): AxiosPromise { return localVarFp.deleteRecordingMedia(accountId, callId, recordingId, options).then((request) => request(axios, basePath)); }, + /** + * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete Transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} recordingId Programmable Voice API Recording ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteRecordingTranscription(accountId: string, callId: string, recordingId: string, options?: any): AxiosPromise { + return localVarFp.deleteRecordingTranscription(accountId, callId, recordingId, options).then((request) => request(axios, basePath)); + }, /** * Downloads the specified recording. * @summary Download Recording @@ -746,7 +746,7 @@ export const RecordingsApiFactory = function (configuration?: Configuration, bas return localVarFp.getCallRecording(accountId, callId, recordingId, options).then((request) => request(axios, basePath)); }, /** - * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. * @summary Get Transcription * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. @@ -754,8 +754,8 @@ export const RecordingsApiFactory = function (configuration?: Configuration, bas * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getCallTranscription(accountId: string, callId: string, recordingId: string, options?: any): AxiosPromise { - return localVarFp.getCallTranscription(accountId, callId, recordingId, options).then((request) => request(axios, basePath)); + getRecordingTranscription(accountId: string, callId: string, recordingId: string, options?: any): AxiosPromise { + return localVarFp.getRecordingTranscription(accountId, callId, recordingId, options).then((request) => request(axios, basePath)); }, /** * Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria. @@ -818,8 +818,8 @@ export const RecordingsApiFactory = function (configuration?: Configuration, bas */ export class RecordingsApi extends BaseAPI { /** - * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - * @summary Delete Transcription + * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete Recording * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. * @param {string} recordingId Programmable Voice API Recording ID. @@ -827,13 +827,13 @@ export class RecordingsApi extends BaseAPI { * @throws {RequiredError} * @memberof RecordingsApi */ - public deleteCallTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { - return RecordingsApiFp(this.configuration).deleteCallTranscription(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); + public deleteRecording(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { + return RecordingsApiFp(this.configuration).deleteRecording(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); } /** - * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - * @summary Delete Recording + * Deletes the specified recording\'s media. + * @summary Delete Recording Media * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. * @param {string} recordingId Programmable Voice API Recording ID. @@ -841,13 +841,13 @@ export class RecordingsApi extends BaseAPI { * @throws {RequiredError} * @memberof RecordingsApi */ - public deleteRecording(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { - return RecordingsApiFp(this.configuration).deleteRecording(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); + public deleteRecordingMedia(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { + return RecordingsApiFp(this.configuration).deleteRecordingMedia(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); } /** - * Deletes the specified recording\'s media. - * @summary Delete Recording Media + * Deletes the specified recording\'s transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete Transcription * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. * @param {string} recordingId Programmable Voice API Recording ID. @@ -855,8 +855,8 @@ export class RecordingsApi extends BaseAPI { * @throws {RequiredError} * @memberof RecordingsApi */ - public deleteRecordingMedia(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { - return RecordingsApiFp(this.configuration).deleteRecordingMedia(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); + public deleteRecordingTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { + return RecordingsApiFp(this.configuration).deleteRecordingTranscription(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); } /** @@ -888,7 +888,7 @@ export class RecordingsApi extends BaseAPI { } /** - * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. * @summary Get Transcription * @param {string} accountId Your Bandwidth Account ID. * @param {string} callId Programmable Voice API Call ID. @@ -897,8 +897,8 @@ export class RecordingsApi extends BaseAPI { * @throws {RequiredError} * @memberof RecordingsApi */ - public getCallTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { - return RecordingsApiFp(this.configuration).getCallTranscription(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); + public getRecordingTranscription(accountId: string, callId: string, recordingId: string, options?: AxiosRequestConfig) { + return RecordingsApiFp(this.configuration).getRecordingTranscription(accountId, callId, recordingId, options).then((request) => request(this.axios, this.basePath)); } /** diff --git a/api/transcriptions-api.ts b/api/transcriptions-api.ts new file mode 100644 index 0000000..6a6bcf9 --- /dev/null +++ b/api/transcriptions-api.ts @@ -0,0 +1,320 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import { CallTranscriptionMetadata } from '../models'; +// @ts-ignore +import { CallTranscriptionResponse } from '../models'; +// @ts-ignore +import { VoiceApiError } from '../models'; +/** + * TranscriptionsApi - axios parameter creator + * @export + */ +export const TranscriptionsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteRealTimeTranscription: async (accountId: string, callId: string, transcriptionId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('deleteRealTimeTranscription', 'accountId', accountId) + // verify required parameter 'callId' is not null or undefined + assertParamExists('deleteRealTimeTranscription', 'callId', callId) + // verify required parameter 'transcriptionId' is not null or undefined + assertParamExists('deleteRealTimeTranscription', 'transcriptionId', transcriptionId) + const localVarPath = `/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"callId"}}`, encodeURIComponent(String(callId))) + .replace(`{${"transcriptionId"}}`, encodeURIComponent(String(transcriptionId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Retrieve a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRealTimeTranscription: async (accountId: string, callId: string, transcriptionId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('getRealTimeTranscription', 'accountId', accountId) + // verify required parameter 'callId' is not null or undefined + assertParamExists('getRealTimeTranscription', 'callId', callId) + // verify required parameter 'transcriptionId' is not null or undefined + assertParamExists('getRealTimeTranscription', 'transcriptionId', transcriptionId) + const localVarPath = `/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"callId"}}`, encodeURIComponent(String(callId))) + .replace(`{${"transcriptionId"}}`, encodeURIComponent(String(transcriptionId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Enumerates the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Enumerate transcriptions made with StartTranscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRealTimeTranscriptions: async (accountId: string, callId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('listRealTimeTranscriptions', 'accountId', accountId) + // verify required parameter 'callId' is not null or undefined + assertParamExists('listRealTimeTranscriptions', 'callId', callId) + const localVarPath = `/accounts/{accountId}/calls/{callId}/transcriptions` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"callId"}}`, encodeURIComponent(String(callId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * TranscriptionsApi - functional programming interface + * @export + */ +export const TranscriptionsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = TranscriptionsApiAxiosParamCreator(configuration) + return { + /** + * Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteRealTimeTranscription(accountId: string, callId: string, transcriptionId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRealTimeTranscription(accountId, callId, transcriptionId, options); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = operationServerMap['TranscriptionsApi.deleteRealTimeTranscription']?.[index]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); + }, + /** + * Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Retrieve a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getRealTimeTranscription(accountId: string, callId: string, transcriptionId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getRealTimeTranscription(accountId, callId, transcriptionId, options); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = operationServerMap['TranscriptionsApi.getRealTimeTranscription']?.[index]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); + }, + /** + * Enumerates the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Enumerate transcriptions made with StartTranscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listRealTimeTranscriptions(accountId: string, callId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listRealTimeTranscriptions(accountId, callId, options); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = operationServerMap['TranscriptionsApi.listRealTimeTranscriptions']?.[index]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); + }, + } +}; + +/** + * TranscriptionsApi - factory interface + * @export + */ +export const TranscriptionsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = TranscriptionsApiFp(configuration) + return { + /** + * Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteRealTimeTranscription(accountId: string, callId: string, transcriptionId: string, options?: any): AxiosPromise { + return localVarFp.deleteRealTimeTranscription(accountId, callId, transcriptionId, options).then((request) => request(axios, basePath)); + }, + /** + * Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Retrieve a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRealTimeTranscription(accountId: string, callId: string, transcriptionId: string, options?: any): AxiosPromise { + return localVarFp.getRealTimeTranscription(accountId, callId, transcriptionId, options).then((request) => request(axios, basePath)); + }, + /** + * Enumerates the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Enumerate transcriptions made with StartTranscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRealTimeTranscriptions(accountId: string, callId: string, options?: any): AxiosPromise> { + return localVarFp.listRealTimeTranscriptions(accountId, callId, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * TranscriptionsApi - object-oriented interface + * @export + * @class TranscriptionsApi + * @extends {BaseAPI} + */ +export class TranscriptionsApi extends BaseAPI { + /** + * Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @summary Delete a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TranscriptionsApi + */ + public deleteRealTimeTranscription(accountId: string, callId: string, transcriptionId: string, options?: AxiosRequestConfig) { + return TranscriptionsApiFp(this.configuration).deleteRealTimeTranscription(accountId, callId, transcriptionId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Retrieve a specific transcription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {string} transcriptionId Programmable Voice API Transcription ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TranscriptionsApi + */ + public getRealTimeTranscription(accountId: string, callId: string, transcriptionId: string, options?: AxiosRequestConfig) { + return TranscriptionsApiFp(this.configuration).getRealTimeTranscription(accountId, callId, transcriptionId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Enumerates the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + * @summary Enumerate transcriptions made with StartTranscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} callId Programmable Voice API Call ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TranscriptionsApi + */ + public listRealTimeTranscriptions(accountId: string, callId: string, options?: AxiosRequestConfig) { + return TranscriptionsApiFp(this.configuration).listRealTimeTranscriptions(accountId, callId, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/bandwidth.yml b/bandwidth.yml index bec9a4e..c2e932a 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -16,6 +16,7 @@ tags: - name: Conferences - name: Recordings - name: Statistics + - name: Transcriptions - name: MFA - name: Phone Number Lookup paths: @@ -962,9 +963,7 @@ paths: description: >- Downloads the specified transcription. - - If the transcribed recording was multi-channel, then there will be 2 - transcripts. + If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and @@ -974,14 +973,14 @@ paths: During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. - operationId: getCallTranscription + operationId: getRecordingTranscription parameters: - $ref: '#/components/parameters/accountId' - $ref: '#/components/parameters/callId' - $ref: '#/components/parameters/recordingId' responses: '200': - $ref: '#/components/responses/getCallTranscriptionResponse' + $ref: '#/components/responses/getRecordingTranscriptionResponse' '400': $ref: '#/components/responses/voiceBadRequestError' '401': @@ -1047,7 +1046,7 @@ paths: transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. - operationId: deleteCallTranscription + operationId: deleteRecordingTranscription parameters: - $ref: '#/components/parameters/accountId' - $ref: '#/components/parameters/callId' @@ -1101,6 +1100,108 @@ paths: '500': $ref: '#/components/responses/voiceInternalServerError' servers: *ref_1 + /accounts/{accountId}/calls/{callId}/transcriptions: + get: + tags: + - Transcriptions + summary: Enumerate transcriptions made with StartTranscription + description: >- + Enumerates the transcriptions created on this call via + [startTranscription](/docs/voice/bxml/startTranscription). + operationId: listRealTimeTranscriptions + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + responses: + '200': + $ref: '#/components/responses/listTranscriptionsResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}: + get: + tags: + - Transcriptions + summary: Retrieve a specific transcription + description: >- + Retrieve the specified transcription that was created on this call via + [startTranscription](/docs/voice/bxml/startTranscription). + operationId: getRealTimeTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/transcriptionId' + responses: + '200': + $ref: '#/components/responses/getCallTranscriptionResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + delete: + tags: + - Transcriptions + summary: Delete a specific transcription + description: >- + Delete the specified transcription that was created on this call via + [startTranscription](/docs/voice/bxml/startTranscription). + + + Note: After the deletion is requested and a `204` is returned, the + transcription will not be accessible anymore. However, it is not deleted + immediately. This deletion process, while transparent and irreversible, + can take an additional 24 to 48 hours. + operationId: deleteRealTimeTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/transcriptionId' + responses: + '204': + $ref: '#/components/responses/deleteCallTranscriptionResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 /accounts/{accountId}/code/voice: post: tags: @@ -2677,7 +2778,7 @@ components: mediaUrl: $ref: '#/components/schemas/mediaUrl' transcription: - $ref: '#/components/schemas/transcriptionMetadata' + $ref: '#/components/schemas/recordingTranscriptionMetadata' conference: type: object properties: @@ -3114,14 +3215,95 @@ components: Current supported languages are English, French, and Spanish. default: false example: true - transcriptionList: + recordingTranscriptions: type: object properties: transcripts: type: array items: $ref: '#/components/schemas/transcription' - transcriptionMetadata: + callTranscriptionMetadataList: + type: array + items: + $ref: '#/components/schemas/callTranscriptionMetadata' + example: + - transcriptionId: t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + transcriptionUrl: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-fef240ff-5cfc9091-8069-4863-a8c0-a4dcbbf1f1a4/transcriptions/t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + callTranscriptionMetadata: + type: object + properties: + transcriptionId: + type: string + description: The programmable voice API transcription ID. + example: t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + transcriptionUrl: + type: string + description: >- + A URL that may be used to retrieve the transcription itself. This + points to the + + [Get Call + Transcription](/apis/voice/#operation/getCallTranscription) + endpoint. + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-fef240ff-5cfc9091-8069-4863-a8c0-a4dcbbf1f1a4/transcriptions/t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + callTranscriptionResponse: + type: object + properties: + accountId: + type: string + description: The user account associated with the call. + example: '920012' + callId: + type: string + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + transcriptionId: + type: string + description: The programmable voice API transcription ID. + example: t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + tracks: + type: array + items: + $ref: '#/components/schemas/callTranscription' + example: + - detectedLanguage: en-US + track: inbound + text: Hello World! This is an example. + confidence: 0.9 + callTranscription: + type: object + properties: + detectedLanguage: + type: string + enum: + - en-US + - es-US + - fr-FR + description: The detected language for this transcription. + example: en-US + track: + type: string + enum: + - inbound + - outbound + description: Which `track` this transcription is derived from. + example: inbound + text: + type: string + description: The transcription itself. + example: Hello World! This is an example. + confidence: + type: number + format: double + minimum: 0 + maximum: 1 + description: >- + How confident the transcription engine was in transcribing the + associated audio (from `0` to `1`). + example: 0.9 + recordingTranscriptionMetadata: nullable: true type: object description: If the recording was transcribed, metadata about the transcription @@ -3693,7 +3875,7 @@ components: fileFormat: $ref: '#/components/schemas/fileFormatEnum' channels: - $ref: '#/components/schemas/status' + $ref: '#/components/schemas/channels' tag: $ref: '#/components/schemas/tag1' status: @@ -4582,12 +4764,26 @@ components: schema: type: string format: binary + getRecordingTranscriptionResponse: + description: Transcription found. + content: + application/json: + schema: + $ref: '#/components/schemas/recordingTranscriptions' + listTranscriptionsResponse: + description: Transcription found. + content: + application/json: + schema: + $ref: '#/components/schemas/callTranscriptionMetadataList' getCallTranscriptionResponse: - description: Transcription found + description: Transcription found. content: application/json: schema: - $ref: '#/components/schemas/transcriptionList' + $ref: '#/components/schemas/callTranscriptionResponse' + deleteCallTranscriptionResponse: + description: Transcription data was deleted. listConferencesResponse: description: Conferences retrieved successfully content: @@ -5090,6 +5286,14 @@ components: type: string description: Programmable Voice API Conference Member ID. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + transcriptionId: + name: transcriptionId + in: path + required: true + schema: + type: string + description: Programmable Voice API Transcription ID. + example: t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 to: name: to in: query @@ -5517,12 +5721,14 @@ components: Basic: type: http scheme: basic - description: |- + description: >- Basic authentication is a simple authentication scheme built into the - HTTP protocol. To use it, send your HTTP requests with an Authorization - header that contains the word Basic followed by a space and a - base64-encoded string `username:password`Example: `Authorization: Basic - ZGVtbZpwQDU1dzByZA==` + HTTP protocol. To use it, send your HTTP requests with an + `Authorization` header that contains the word `Basic` followed by a + space and a Base64-encoded string `username:password`. + + + - Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==` callbacks: inboundCallback: '{inboundCallbackUrl}': diff --git a/base.ts b/base.ts index 538e16c..dcebdd7 100644 --- a/base.ts +++ b/base.ts @@ -233,19 +233,19 @@ export const operationServerMap: ServerMap = { description: "Production", } ], - "RecordingsApi.deleteCallTranscription": [ + "RecordingsApi.deleteRecording": [ { url: "https://voice.bandwidth.com/api/v2", description: "Production", } ], - "RecordingsApi.deleteRecording": [ + "RecordingsApi.deleteRecordingMedia": [ { url: "https://voice.bandwidth.com/api/v2", description: "Production", } ], - "RecordingsApi.deleteRecordingMedia": [ + "RecordingsApi.deleteRecordingTranscription": [ { url: "https://voice.bandwidth.com/api/v2", description: "Production", @@ -263,7 +263,7 @@ export const operationServerMap: ServerMap = { description: "Production", } ], - "RecordingsApi.getCallTranscription": [ + "RecordingsApi.getRecordingTranscription": [ { url: "https://voice.bandwidth.com/api/v2", description: "Production", @@ -299,4 +299,22 @@ export const operationServerMap: ServerMap = { description: "Production", } ], + "TranscriptionsApi.deleteRealTimeTranscription": [ + { + url: "https://voice.bandwidth.com/api/v2", + description: "Production", + } + ], + "TranscriptionsApi.getRealTimeTranscription": [ + { + url: "https://voice.bandwidth.com/api/v2", + description: "Production", + } + ], + "TranscriptionsApi.listRealTimeTranscriptions": [ + { + url: "https://voice.bandwidth.com/api/v2", + description: "Production", + } + ], } diff --git a/models/call-recording-metadata.ts b/models/call-recording-metadata.ts index 024ebf3..a28b0d7 100644 --- a/models/call-recording-metadata.ts +++ b/models/call-recording-metadata.ts @@ -21,7 +21,7 @@ import { CallDirectionEnum } from './call-direction-enum'; import { FileFormatEnum } from './file-format-enum'; // May contain unused imports in some cases // @ts-ignore -import { TranscriptionMetadata } from './transcription-metadata'; +import { RecordingTranscriptionMetadata } from './recording-transcription-metadata'; /** * @@ -133,10 +133,10 @@ export interface CallRecordingMetadata { 'mediaUrl'?: string | null; /** * - * @type {TranscriptionMetadata} + * @type {RecordingTranscriptionMetadata} * @memberof CallRecordingMetadata */ - 'transcription'?: TranscriptionMetadata | null; + 'transcription'?: RecordingTranscriptionMetadata | null; } diff --git a/models/call-transcription-metadata.ts b/models/call-transcription-metadata.ts new file mode 100644 index 0000000..a7525f6 --- /dev/null +++ b/models/call-transcription-metadata.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface CallTranscriptionMetadata + */ +export interface CallTranscriptionMetadata { + /** + * The programmable voice API transcription ID. + * @type {string} + * @memberof CallTranscriptionMetadata + */ + 'transcriptionId'?: string; + /** + * A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice/#operation/getCallTranscription) endpoint. + * @type {string} + * @memberof CallTranscriptionMetadata + */ + 'transcriptionUrl'?: string; +} + diff --git a/models/call-transcription-response.ts b/models/call-transcription-response.ts new file mode 100644 index 0000000..94a4da8 --- /dev/null +++ b/models/call-transcription-response.ts @@ -0,0 +1,51 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { CallTranscription } from './call-transcription'; + +/** + * + * @export + * @interface CallTranscriptionResponse + */ +export interface CallTranscriptionResponse { + /** + * The user account associated with the call. + * @type {string} + * @memberof CallTranscriptionResponse + */ + 'accountId'?: string; + /** + * The call id associated with the event. + * @type {string} + * @memberof CallTranscriptionResponse + */ + 'callId'?: string; + /** + * The programmable voice API transcription ID. + * @type {string} + * @memberof CallTranscriptionResponse + */ + 'transcriptionId'?: string; + /** + * + * @type {Array} + * @memberof CallTranscriptionResponse + */ + 'tracks'?: Array; +} + diff --git a/models/call-transcription.ts b/models/call-transcription.ts new file mode 100644 index 0000000..c5ed049 --- /dev/null +++ b/models/call-transcription.ts @@ -0,0 +1,63 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface CallTranscription + */ +export interface CallTranscription { + /** + * The detected language for this transcription. + * @type {string} + * @memberof CallTranscription + */ + 'detectedLanguage'?: CallTranscriptionDetectedLanguageEnum; + /** + * Which `track` this transcription is derived from. + * @type {string} + * @memberof CallTranscription + */ + 'track'?: CallTranscriptionTrackEnum; + /** + * The transcription itself. + * @type {string} + * @memberof CallTranscription + */ + 'text'?: string; + /** + * How confident the transcription engine was in transcribing the associated audio (from `0` to `1`). + * @type {number} + * @memberof CallTranscription + */ + 'confidence'?: number; +} + +export const CallTranscriptionDetectedLanguageEnum = { + EnUs: 'en-US', + EsUs: 'es-US', + FrFr: 'fr-FR' +} as const; + +export type CallTranscriptionDetectedLanguageEnum = typeof CallTranscriptionDetectedLanguageEnum[keyof typeof CallTranscriptionDetectedLanguageEnum]; +export const CallTranscriptionTrackEnum = { + Inbound: 'inbound', + Outbound: 'outbound' +} as const; + +export type CallTranscriptionTrackEnum = typeof CallTranscriptionTrackEnum[keyof typeof CallTranscriptionTrackEnum]; + + diff --git a/models/index.ts b/models/index.ts index c43d81e..a6658e3 100644 --- a/models/index.ts +++ b/models/index.ts @@ -6,6 +6,9 @@ export * from './call-direction-enum'; export * from './call-recording-metadata'; export * from './call-state'; export * from './call-state-enum'; +export * from './call-transcription'; +export * from './call-transcription-metadata'; +export * from './call-transcription-response'; export * from './callback-method-enum'; export * from './code-request'; export * from './conference'; @@ -65,6 +68,8 @@ export * from './priority-enum'; export * from './recording-available-callback'; export * from './recording-complete-callback'; export * from './recording-state-enum'; +export * from './recording-transcription-metadata'; +export * from './recording-transcriptions'; export * from './redirect-callback'; export * from './redirect-method-enum'; export * from './stir-shaken'; @@ -73,8 +78,6 @@ export * from './tn-lookup-request-error'; export * from './transcribe-recording'; export * from './transcription'; export * from './transcription-available-callback'; -export * from './transcription-list'; -export * from './transcription-metadata'; export * from './transfer-answer-callback'; export * from './transfer-complete-callback'; export * from './transfer-disconnect-callback'; diff --git a/models/recording-available-callback.ts b/models/recording-available-callback.ts index b7061c6..119e7c9 100644 --- a/models/recording-available-callback.ts +++ b/models/recording-available-callback.ts @@ -129,11 +129,11 @@ export interface RecordingAvailableCallback { */ 'fileFormat'?: FileFormatEnum; /** - * The current status of the process. For recording, current possible values are \'processing\', \'partial\', \'complete\', \'deleted\', and \'error\'. For transcriptions, current possible values are \'none\', \'processing\', \'available\', \'error\', \'timeout\', \'file-size-too-big\', and \'file-size-too-small\'. Additional states may be added in the future, so your application must be tolerant of unknown values. - * @type {string} + * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * @type {number} * @memberof RecordingAvailableCallback */ - 'channels'?: string; + 'channels'?: number; /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @type {string} diff --git a/models/recording-transcription-metadata.ts b/models/recording-transcription-metadata.ts new file mode 100644 index 0000000..edd0b96 --- /dev/null +++ b/models/recording-transcription-metadata.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * If the recording was transcribed, metadata about the transcription + * @export + * @interface RecordingTranscriptionMetadata + */ +export interface RecordingTranscriptionMetadata { + /** + * The unique transcription ID + * @type {string} + * @memberof RecordingTranscriptionMetadata + */ + 'id'?: string; + /** + * The current status of the process. For recording, current possible values are \'processing\', \'partial\', \'complete\', \'deleted\', and \'error\'. For transcriptions, current possible values are \'none\', \'processing\', \'available\', \'error\', \'timeout\', \'file-size-too-big\', and \'file-size-too-small\'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @type {string} + * @memberof RecordingTranscriptionMetadata + */ + 'status'?: string; + /** + * The time that the transcription was completed + * @type {string} + * @memberof RecordingTranscriptionMetadata + */ + 'completedTime'?: string; + /** + * The URL of the [transcription](#operation/getCallTranscription) + * @type {string} + * @memberof RecordingTranscriptionMetadata + */ + 'url'?: string; +} + diff --git a/models/recording-transcriptions.ts b/models/recording-transcriptions.ts new file mode 100644 index 0000000..1f539b7 --- /dev/null +++ b/models/recording-transcriptions.ts @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { Transcription } from './transcription'; + +/** + * + * @export + * @interface RecordingTranscriptions + */ +export interface RecordingTranscriptions { + /** + * + * @type {Array} + * @memberof RecordingTranscriptions + */ + 'transcripts'?: Array; +} + diff --git a/tests/integration/recordings-api.test.js b/tests/integration/recordings-api.test.js index 3ae0a7c..d1d7e30 100644 --- a/tests/integration/recordings-api.test.js +++ b/tests/integration/recordings-api.test.js @@ -137,9 +137,9 @@ describe('RecordingsApi', () => { }); }); - describe('getCallTranscription', () => { - test('should get call transcription', async () => { - const { status, data } = await recordingsApi.getCallTranscription(BW_ACCOUNT_ID, mantecaCallId, recordingId); + describe('getRecordingTranscription', () => { + test('should get recording transcription', async () => { + const { status, data } = await recordingsApi.getRecordingTranscription(BW_ACCOUNT_ID, mantecaCallId, recordingId); expect(status).toEqual(200); expect(data.transcripts).toBeInstanceOf(Array); @@ -148,9 +148,9 @@ describe('RecordingsApi', () => { }); }); - describe('deleteCallTranscription', () => { - test('should delete call transcription', async () => { - const { status } = await recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, mantecaCallId, recordingId); + describe('deleteRecordingTranscription', () => { + test('should delete recording transcription', async () => { + const { status } = await recordingsApi.deleteRecordingTranscription(BW_ACCOUNT_ID, mantecaCallId, recordingId); expect(status).toEqual(204); }); diff --git a/tests/integration/transcriptions-api.test.js b/tests/integration/transcriptions-api.test.js new file mode 100644 index 0000000..fbf0876 --- /dev/null +++ b/tests/integration/transcriptions-api.test.js @@ -0,0 +1,85 @@ +const { CallsApi } = require('../../api/calls-api'); +const { TranscriptionsApi } = require('../../api/transcriptions-api'); +const { Configuration } = require('../../configuration'); +const { RecordingStateEnum, CallStateEnum } = require('../../models'); +const { setupManteca, createMantecaCall, cleanupCalls, getMantecaTestStatus, sleep } = require('../callUtils'); + +describe('TranscriptionsApi', () => { + jest.setTimeout(240000); + const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD}); + const callsApi = new CallsApi(config); + const transcriptionsApi = new TranscriptionsApi(config); + + let transcriptionId, mantecaTestId, mantecaCallId; + let activeCalls = []; + + beforeAll(async () => { + mantecaTestId = await setupManteca('CALL'); + mantecaCallId = await createMantecaCall(callsApi, mantecaTestId, '/bxml/idle'); + activeCalls.push(mantecaCallId); + }); + + afterAll(async () => { + await cleanupCalls(activeCalls, callsApi); + }); + + describe('createCallTranscription', () => { + test('should create call transcription', async () => { + await sleep(SLEEP_TIME_S); + + const startTranscriptionBxml = + ``; + const { status: startStatus } = + await callsApi.updateCallBxml(BW_ACCOUNT_ID, mantecaCallId, startTranscriptionBxml); + expect(startStatus).toEqual(204); + await sleep(SLEEP_TIME_S); + + const stopTranscriptionBxml = + ``; + const { status: stopStatus } = + await callsApi.updateCallBxml(BW_ACCOUNT_ID, mantecaCallId, stopTranscriptionBxml); + expect(stopStatus).toEqual(204); + await sleep(SLEEP_TIME_S); + + const { status: completeStatus } = + await callsApi.updateCall(BW_ACCOUNT_ID, mantecaCallId, { state: CallStateEnum.Completed }); + expect(completeStatus).toEqual(200); + }); + }); + + describe('listCallTranscriptions', () => { + test('should list call transcriptions', async () => { + await sleep(SLEEP_TIME_S * 20); + + const { status, data } = + await transcriptionsApi.listRealTimeTranscriptions(BW_ACCOUNT_ID, mantecaCallId); + expect(status).toEqual(200); + expect(data).toBeInstanceOf(Array); + expect(typeof data[0].transcriptionId).toBe('string'); + expect(typeof data[0].transcriptionUrl).toBe('string'); + transcriptionId = data[0].transcriptionId; + }); + }); + + describe('getCallTranscription', () => { + test('should get call transcription', async () => { + const { status, data } = + await transcriptionsApi.getRealTimeTranscription(BW_ACCOUNT_ID, mantecaCallId, transcriptionId); + expect(status).toEqual(200); + expect(data.accountId).toEqual(BW_ACCOUNT_ID); + expect(data.callId).toEqual(mantecaCallId); + expect(data.transcriptionId).toEqual(transcriptionId); + expect(data.tracks).toBeInstanceOf(Array); + expect(data.tracks[0].track).toEqual('inbound'); + expect(typeof data.tracks[0].confidence).toBe('number'); + }); + }); + + describe('deleteCallTranscription', () => { + test('should delete call transcription', async () => { + const { status } = + await transcriptionsApi.deleteRealTimeTranscription(BW_ACCOUNT_ID, mantecaCallId, transcriptionId); + expect(status).toEqual(200); // This is a bug in the API, it should return 204. VAPI-1863 should fix this. + }); + }); +});