-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SWI-2792 Add Transcription BXML (#78)
* SWI-2792 Add Transcription BXML * update stream verbs * add tests and update to use arrow functions * update get call logic * remove instanceof check * remove big jest timeout
- Loading branch information
Showing
9 changed files
with
345 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { XMLElement } from 'xmlbuilder' | ||
import { Verb } from './Verb' | ||
|
||
export interface CustomParamOptions { | ||
name: string | ||
|
||
value: string | ||
} | ||
|
||
export class CustomParam implements CustomParamOptions, Verb { | ||
name: string | ||
|
||
value: string | ||
|
||
constructor(options: CustomParamOptions) { | ||
this.name = options.name | ||
this.value = options.value | ||
} | ||
|
||
addXml(xml: XMLElement) { | ||
const attributes: {[key: string]: string} = {} | ||
|
||
attributes['name'] = this.name | ||
|
||
attributes['value'] = this.value | ||
|
||
xml.ele('CustomParam', attributes) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { XMLElement } from 'xmlbuilder' | ||
import { Verb } from './Verb' | ||
|
||
export interface StartTranscriptionOptions { | ||
name?: string | ||
|
||
tracks?: string | ||
|
||
transcriptionEventUrl?: string | ||
|
||
transcriptionEventMethod?: string | ||
|
||
username?: string | ||
|
||
password?: string | ||
|
||
destination?: string | ||
|
||
stabilized?: boolean | ||
|
||
customParams?: Verb[] | ||
} | ||
|
||
export class StartTranscription implements StartTranscriptionOptions, Verb { | ||
|
||
name?: string | ||
|
||
tracks?: string | ||
|
||
transcriptionEventUrl?: string | ||
|
||
transcriptionEventMethod?: string | ||
|
||
username?: string | ||
|
||
password?: string | ||
|
||
destination?: string | ||
|
||
stabilized?: boolean | ||
|
||
customParams?: Verb[] | ||
|
||
constructor(options: StartTranscriptionOptions) { | ||
this.name = options.name | ||
this.tracks = options.tracks | ||
this.transcriptionEventUrl = options.transcriptionEventUrl | ||
this.customParams = options.customParams || [] | ||
this.transcriptionEventMethod = options.transcriptionEventMethod | ||
this.username = options.username | ||
this.password = options.password | ||
this.destination = options.destination | ||
this.stabilized = options.stabilized | ||
} | ||
|
||
addXml(xml: XMLElement) { | ||
const attributes: {[key: string]: string} = {} | ||
|
||
if (this.name !== undefined) { | ||
attributes['name'] = this.name | ||
} | ||
|
||
if (this.tracks !== undefined) { | ||
attributes['tracks'] = this.tracks | ||
} | ||
if (this.transcriptionEventUrl !== undefined) { | ||
attributes['transcriptionEventUrl'] = this.transcriptionEventUrl | ||
} | ||
|
||
if (this.transcriptionEventMethod !== undefined) { | ||
attributes['transcriptionEventMethod'] = this.transcriptionEventMethod | ||
} | ||
|
||
if (this.username !== undefined) { | ||
attributes['username'] = this.username | ||
} | ||
|
||
if (this.password !== undefined) { | ||
attributes['password'] = this.password | ||
} | ||
|
||
if (this.destination !== undefined) { | ||
attributes['destination'] = this.destination | ||
} | ||
|
||
if (this.stabilized !== undefined) { | ||
attributes['stabilized'] = `${this.stabilized}` | ||
} | ||
|
||
var StartTranscription = xml.ele('StartTranscription', attributes) | ||
|
||
if (Array.isArray(this.customParams)) { | ||
this.customParams.forEach( (verb) => { | ||
verb.addXml(StartTranscription) | ||
}) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { XMLElement } from 'xmlbuilder' | ||
import { Verb } from './Verb' | ||
|
||
export interface StopTranscriptionOptions { | ||
name?: string | ||
} | ||
|
||
export class StopTranscription implements StopTranscriptionOptions, Verb { | ||
name?: string | ||
|
||
constructor(options: StopTranscriptionOptions) { | ||
this.name = options.name | ||
} | ||
|
||
addXml(xml: XMLElement) { | ||
const attributes: {[key: string]: string} = {} | ||
|
||
if (this.name !== undefined) { | ||
attributes['name'] = this.name | ||
} | ||
|
||
xml.ele('StopTranscription', attributes) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.