Skip to content

Commit

Permalink
SWI-5543 Update SDK Based on Recent Spec Changes (#35)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: ckoegel <[email protected]>
  • Loading branch information
3 people authored Jul 1, 2024
1 parent aa69a2d commit 4b530aa
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -26,7 +29,7 @@ env:

jobs:
test_main:
name: Nightly Smoke Test
name: Smoke Test
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 20 additions & 15 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down
32 changes: 32 additions & 0 deletions models/call-transcription-detected-language-enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* tslint:disable */
/* eslint-disable */
/**
* Bandwidth
* Bandwidth\'s Communication APIs
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* 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];



31 changes: 31 additions & 0 deletions models/call-transcription-track-enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* tslint:disable */
/* eslint-disable */
/**
* Bandwidth
* Bandwidth\'s Communication APIs
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* 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];



29 changes: 11 additions & 18 deletions models/call-transcription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
*
Expand All @@ -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;
Expand All @@ -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}
Expand All @@ -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];


2 changes: 2 additions & 0 deletions models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
13 changes: 8 additions & 5 deletions tests/unit/api/messages-api.test.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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();

Expand Down
11 changes: 7 additions & 4 deletions tests/unit/api/transcriptions-api.test.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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();
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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');
});
});
8 changes: 8 additions & 0 deletions tests/unit/models/call-transcription-track-enum.test.ts
Original file line number Diff line number Diff line change
@@ -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');
});
});

0 comments on commit 4b530aa

Please sign in to comment.