From 4b530aacc17e346d53d87a9c9b238617d881390f Mon Sep 17 00:00:00 2001 From: "band-swi[bot]" <143147434+band-swi[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:12:24 -0400 Subject: [PATCH] SWI-5543 Update SDK Based on Recent Spec Changes (#35) * Generate SDK with OpenAPI Generator Version 7.6.0 * formatting * update transcriptions tests * update smoke test wf * add unit tests for new enum models --------- Co-authored-by: DX-Bandwidth Co-authored-by: ckoegel --- .../{test-nightly.yml => test-smoke.yml} | 7 ++-- .openapi-generator/FILES | 2 ++ bandwidth.yml | 35 +++++++++++-------- ...ll-transcription-detected-language-enum.ts | 32 +++++++++++++++++ models/call-transcription-track-enum.ts | 31 ++++++++++++++++ models/call-transcription.ts | 29 ++++++--------- models/index.ts | 2 ++ tests/unit/api/messages-api.test.ts | 13 ++++--- tests/unit/api/transcriptions-api.test.ts | 11 +++--- ...anscription-detected-language-enum.test.ts | 9 +++++ .../call-transcription-track-enum.test.ts | 8 +++++ 11 files changed, 135 insertions(+), 44 deletions(-) rename .github/workflows/{test-nightly.yml => test-smoke.yml} (94%) create mode 100644 models/call-transcription-detected-language-enum.ts create mode 100644 models/call-transcription-track-enum.ts create mode 100644 tests/unit/models/call-transcription-detected-language-enum.test.ts create mode 100644 tests/unit/models/call-transcription-track-enum.test.ts diff --git a/.github/workflows/test-nightly.yml b/.github/workflows/test-smoke.yml similarity index 94% rename from .github/workflows/test-nightly.yml rename to .github/workflows/test-smoke.yml index 5356d0d..e2eaf3b 100644 --- a/.github/workflows/test-nightly.yml +++ b/.github/workflows/test-smoke.yml @@ -1,8 +1,11 @@ -name: Nightly Smoke Tests +name: Smoke Tests on: schedule: - cron: "0 4 * * *" + pull_request: + paths: + - "tests/smoke/**" concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} @@ -26,7 +29,7 @@ env: jobs: test_main: - name: Nightly Smoke Test + name: Smoke Test runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 38f9587..bb83d6b 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -23,8 +23,10 @@ models/call-direction-enum.ts models/call-recording-metadata.ts models/call-state-enum.ts models/call-state.ts +models/call-transcription-detected-language-enum.ts models/call-transcription-metadata.ts models/call-transcription-response.ts +models/call-transcription-track-enum.ts models/call-transcription.ts models/callback-method-enum.ts models/code-request.ts diff --git a/bandwidth.yml b/bandwidth.yml index 2ae0756..f3e5be8 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -2131,6 +2131,21 @@ components: and will include its result. example: async + callTranscriptionDetectedLanguageEnum: + type: string + enum: + - en-US + - es-US + - fr-FR + description: The detected language for this transcription. + example: en-US + callTranscriptionTrackEnum: + type: string + enum: + - inbound + - outbound + description: Which `track` this transcription is derived from. + example: inbound createCall: type: object required: @@ -3281,27 +3296,16 @@ components: example: - detectedLanguage: en-US track: inbound - text: Hello World! This is an example. + transcript: 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 + $ref: '#/components/schemas/callTranscriptionDetectedLanguageEnum' track: - type: string - enum: - - inbound - - outbound - description: Which `track` this transcription is derived from. - example: inbound - text: + $ref: '#/components/schemas/callTranscriptionTrackEnum' + transcript: type: string description: The transcription itself. example: Hello World! This is an example. @@ -3327,6 +3331,7 @@ components: $ref: '#/components/schemas/status' completedTime: type: string + format: date-time description: The time that the transcription was completed example: '2022-06-13T18:46:29.715Z' url: diff --git a/models/call-transcription-detected-language-enum.ts b/models/call-transcription-detected-language-enum.ts new file mode 100644 index 0000000..41e6006 --- /dev/null +++ b/models/call-transcription-detected-language-enum.ts @@ -0,0 +1,32 @@ +/* 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. + */ + + + +/** + * The detected language for this transcription. + * @export + * @enum {string} + */ + +export const CallTranscriptionDetectedLanguageEnum = { + EnUs: 'en-US', + EsUs: 'es-US', + FrFr: 'fr-FR' +} as const; + +export type CallTranscriptionDetectedLanguageEnum = typeof CallTranscriptionDetectedLanguageEnum[keyof typeof CallTranscriptionDetectedLanguageEnum]; + + + diff --git a/models/call-transcription-track-enum.ts b/models/call-transcription-track-enum.ts new file mode 100644 index 0000000..33c32b0 --- /dev/null +++ b/models/call-transcription-track-enum.ts @@ -0,0 +1,31 @@ +/* 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. + */ + + + +/** + * Which `track` this transcription is derived from. + * @export + * @enum {string} + */ + +export const CallTranscriptionTrackEnum = { + Inbound: 'inbound', + Outbound: 'outbound' +} as const; + +export type CallTranscriptionTrackEnum = typeof CallTranscriptionTrackEnum[keyof typeof CallTranscriptionTrackEnum]; + + + diff --git a/models/call-transcription.ts b/models/call-transcription.ts index c5ed049..230edc9 100644 --- a/models/call-transcription.ts +++ b/models/call-transcription.ts @@ -13,6 +13,12 @@ */ +// May contain unused imports in some cases +// @ts-ignore +import type { CallTranscriptionDetectedLanguageEnum } from './call-transcription-detected-language-enum'; +// May contain unused imports in some cases +// @ts-ignore +import type { CallTranscriptionTrackEnum } from './call-transcription-track-enum'; /** * @@ -21,14 +27,14 @@ */ export interface CallTranscription { /** - * The detected language for this transcription. - * @type {string} + * + * @type {CallTranscriptionDetectedLanguageEnum} * @memberof CallTranscription */ 'detectedLanguage'?: CallTranscriptionDetectedLanguageEnum; /** - * Which `track` this transcription is derived from. - * @type {string} + * + * @type {CallTranscriptionTrackEnum} * @memberof CallTranscription */ 'track'?: CallTranscriptionTrackEnum; @@ -37,7 +43,7 @@ export interface CallTranscription { * @type {string} * @memberof CallTranscription */ - 'text'?: string; + 'transcript'?: string; /** * How confident the transcription engine was in transcribing the associated audio (from `0` to `1`). * @type {number} @@ -46,18 +52,5 @@ export interface 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 a6658e3..00a3553 100644 --- a/models/index.ts +++ b/models/index.ts @@ -7,8 +7,10 @@ export * from './call-recording-metadata'; export * from './call-state'; export * from './call-state-enum'; export * from './call-transcription'; +export * from './call-transcription-detected-language-enum'; export * from './call-transcription-metadata'; export * from './call-transcription-response'; +export * from './call-transcription-track-enum'; export * from './callback-method-enum'; export * from './code-request'; export * from './conference'; diff --git a/tests/unit/api/messages-api.test.ts b/tests/unit/api/messages-api.test.ts index 9ae7fe1..cc40a93 100644 --- a/tests/unit/api/messages-api.test.ts +++ b/tests/unit/api/messages-api.test.ts @@ -1,7 +1,14 @@ //@ts-nocheck import { MessagesApi } from '../../../api'; import { Configuration } from '../../../configuration'; -import { ListMessageDirectionEnum, MessageDirectionEnum, MessageRequest, MessageStatusEnum, MessageTypeEnum, PriorityEnum } from '../../../models'; +import { + ListMessageDirectionEnum, + MessageDirectionEnum, + MessageRequest, + MessageStatusEnum, + MessageTypeEnum, + PriorityEnum +} from '../../../models'; describe('MessagesApi', () => { const config = new Configuration({ @@ -11,13 +18,9 @@ describe('MessagesApi', () => { }); const messagesApi = new MessagesApi(config); - const mmsText = 'nodejs sdk test MMS'; const smsText = 'nodejs sdk test SMS'; - const mmsTag = 'nodejs sdk test MMS tag'; const smsTag = 'nodejs sdk test SMS tag'; - const mediaUrl = 'https://cdn2.thecatapi.com/images/MTY3ODk4Mg.jpg'; const priority = PriorityEnum.High; - const listMessageDirection = ListMessageDirectionEnum.Outbound; const expirationTime = Date.now() + 1000 * 60 * 60 * 24 + 60; const expiration = new Date(expirationTime).toISOString(); diff --git a/tests/unit/api/transcriptions-api.test.ts b/tests/unit/api/transcriptions-api.test.ts index 0828560..e2c7876 100644 --- a/tests/unit/api/transcriptions-api.test.ts +++ b/tests/unit/api/transcriptions-api.test.ts @@ -1,7 +1,7 @@ //@ts-nocheck -import { CallsApi, TranscriptionsApi } from "../../../api"; +import { TranscriptionsApi } from "../../../api"; import { Configuration } from "../../../configuration"; -import { CallStateEnum, CallTranscriptionDetectedLanguageEnum, CallTranscriptionTrackEnum } from "../../../models"; +import { CallTranscriptionDetectedLanguageEnum, CallTranscriptionTrackEnum } from "../../../models"; describe('TranscriptionsApi', () => { const config = new Configuration({ @@ -41,8 +41,11 @@ describe('TranscriptionsApi', () => { CallTranscriptionDetectedLanguageEnum.EsUs, CallTranscriptionDetectedLanguageEnum.FrFr ]); - expect(data.tracks![0].track).toBeOneOf([CallTranscriptionTrackEnum.Inbound, CallTranscriptionTrackEnum.Outbound]) - expect(data.tracks![0].text).toBeString(); + expect(data.tracks![0].track).toBeOneOf([ + CallTranscriptionTrackEnum.Inbound, + CallTranscriptionTrackEnum.Outbound + ]); + expect(data.tracks![0].transcript).toBeString(); expect(data.tracks![0].confidence).toBeNumber(); }); }); diff --git a/tests/unit/models/call-transcription-detected-language-enum.test.ts b/tests/unit/models/call-transcription-detected-language-enum.test.ts new file mode 100644 index 0000000..ab847b1 --- /dev/null +++ b/tests/unit/models/call-transcription-detected-language-enum.test.ts @@ -0,0 +1,9 @@ +import { CallTranscriptionDetectedLanguageEnum } from '../../../models/call-transcription-detected-language-enum'; + +describe('CallTranscriptionTrackEnum', () => { + test('should define the expected values', () => { + expect(CallTranscriptionDetectedLanguageEnum.EnUs).toBe('en-US'); + expect(CallTranscriptionDetectedLanguageEnum.EsUs).toBe('es-US'); + expect(CallTranscriptionDetectedLanguageEnum.FrFr).toBe('fr-FR'); + }); +}); diff --git a/tests/unit/models/call-transcription-track-enum.test.ts b/tests/unit/models/call-transcription-track-enum.test.ts new file mode 100644 index 0000000..d457866 --- /dev/null +++ b/tests/unit/models/call-transcription-track-enum.test.ts @@ -0,0 +1,8 @@ +import { CallTranscriptionTrackEnum } from '../../../models/call-transcription-track-enum'; + +describe('CallTranscriptionTrackEnum', () => { + test('should define the expected values', () => { + expect(CallTranscriptionTrackEnum.Inbound).toBe('inbound'); + expect(CallTranscriptionTrackEnum.Outbound).toBe('outbound'); + }); +});