import SpeechChallengeController from 'itslanguage/administrative-sdk/speech-challenge/speech-challenge-controller.js'
SpeechChallengeController
Controller class for the SpeechChallenge model.
Constructor Summary
Public Constructor | ||
public |
constructor(connection: Connection) |
Member Summary
Private Members | ||
private |
Object to use for making a connection to the REST API and Websocket server. |
Method Summary
Public Methods | ||
public |
createSpeechChallenge(speechChallenge: SpeechChallenge, audioBlob: Blob, srtFile: Blob, image: Blob, metadata: string): Promise<PronunciationChallenge> Create a speech challenge in the current active Organisation derived from the OAuth2 scope. |
|
public |
getSpeechChallenge(challengeId: string): Promise<PronunciationChallenge> Get a speech challenge from the current active Organisation derived from the OAuth2 scope. |
|
public |
Get and return all speech challenges in the current active Organisation derived from the OAuth2 scope. |
Public Constructors
public constructor(connection: Connection) source
Params:
Name | Type | Attribute | Description |
connection | Connection | Object to use for making a connection to the REST API and Websocket server. |
Private Members
private _connection: Connection source
Object to use for making a connection to the REST API and Websocket server.
Public Methods
public createSpeechChallenge(speechChallenge: SpeechChallenge, audioBlob: Blob, srtFile: Blob, image: Blob, metadata: string): Promise<PronunciationChallenge> source
Create a speech challenge in the current active Organisation derived from the OAuth2 scope.
The created speech challenge will not contain the submitted audio file, but instead a property
referenceAudioUrl
which is the URL to download the submitted audio file.
Additional information like .srt files or images can also be added in HTML5 Blob format.
The returned SpeechChallenge will contain links to download the given files.
Params:
Name | Type | Attribute | Description |
speechChallenge | SpeechChallenge | Object to create. |
|
audioBlob | Blob |
|
Audio fragment to link to the challenge. |
srtFile | Blob |
|
SRT file in HTML5 Blob format to accompany the challenge. |
image | Blob |
|
Image file in HTML5 Blob format to accompany the challenge. |
metadata | string |
|
Metadata in String format to accompany the challenge. |
Throw:
Promise.<Error> |
speechChallenge field of type "SpeechChallenge" is required |
Promise.<Error> |
audioBlob parameter of type "Blob" is required. |
Promise.<Error> |
srtFile parameter of type "Blob" is required. |
Promise.<Error> |
image parameter of type "Blob" is required. |
Promise.<Error> |
metadata parameter of type "String" is required. |
Promise.<Error> |
If the server returned an error. |
public getSpeechChallenge(challengeId: string): Promise<PronunciationChallenge> source
Get a speech challenge from the current active Organisation derived from the OAuth2 scope.
The returned speech challenge will not contain an audio file, but instead a property
referenceAudioUrl
which is the URL to download the submitted audio file.
Params:
Name | Type | Attribute | Description |
challengeId | string | Specify a speech challenge identifier. |
Throw:
Promise.<Error> |
SpeechChallenge#id field of type "string" is required. |
Promise.<Error> |
If no result could not be found. |
public getSpeechChallenges(): Promise<SpeechChallenge[]> source
Get and return all speech challenges in the current active Organisation derived from the OAuth2 scope.
Throw:
Promise.<Error> |
If no result could not be found. |