Home Manual Reference Source
private class | source

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

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:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
speechChallenge SpeechChallenge

Object to create.

audioBlob Blob
  • nullable: true

Audio fragment to link to the challenge.

srtFile Blob
  • nullable: true

SRT file in HTML5 Blob format to accompany the challenge.

image Blob
  • nullable: true

Image file in HTML5 Blob format to accompany the challenge.

metadata string
  • nullable: true

Metadata in String format to accompany the challenge.

Return:

Promise<PronunciationChallenge>

Promise containing the newly created SpeechChallenge.

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:

NameTypeAttributeDescription
challengeId string

Specify a speech challenge identifier.

Return:

Promise<PronunciationChallenge>

Promise containing a SpeechChallenge.

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.

Return:

Promise<SpeechChallenge[]>

Promise containing an array of SpeechChallenges.

Throw:

Promise.<Error>

If no result could not be found.