Home Manual Reference Source
public class | source

AdministrativeSDK

Facade for all methods used in the ITSLanguage Administrative SDK.

Constructor Summary

Public Constructor
public

constructor(connection: Connection)

Member Summary

Private Members
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private

Method Summary

Public Methods
public

Create a category.

public

Create a choice challenge.

public

Register credentials to the given user.

public

Create a group.

public

Create an organisation.

public

Create a pronunciation challenge.

public

Create a speech challenge in the current active Organisation derived from the OAuth2 scope.

public

Create a user.

public

Delete a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

public

Get and return all categories which have a specific category as parent.

public

Get a category.

public

Get a choice challenge.

public

Get and return all choice challenges in the current active Organisation derived from the OAuth2 scope.

public

getChoiceRecognition(challengeId: string, recognitionId: string): Promise<ChoiceRecognition>

Get a choice recognition in a choice challenge from the current active Organisation derived from the OAuth2 scope.

public

Get and return all choice recognitions in a specific ChoiceChallenge from the current active Organisation derived from the OAuth2 scope.

public

Get the current authenticated user.

public

Get a group which is part of the current active Organisation derived from the OAuth2 scope.

public

Get and return all groups in the current active Organisation derived from the OAuth2 scope.

public

Get an organisation.

public

Get and return all organisations the current tenant is the owner of.

public

Get the profile of the given user active in the current active Organisation derived from the OAuth2 scope.

public

Get and return all profiles of all users in the current active Organisation derived from the OAuth2 scope.

public

getProgress(categoryId: string, groupId: string, roles: Array): Promise<Progress[]>

Get and return progress on the requested {@Link Category} for the current {@Link User} derived from the OAuth2 scope.

public

Get and return all pronunciation analyses in a specific pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

public

Get a pronunciation analysis in a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

public

Get a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

public

Get and return all pronunciation challenges in the current active Organisation derived from the OAuth2 scope.

public

getRole(roleId: string): Promise<Role>

Get a single role.

public

Get and return all roles available in the API.

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

getSpeechRecording(challengeId: string, recordingId: string): Promise<SpeechRecording>

Get a speech recording in a speech challenge from the current active Organisation derived from the OAuth2 scope.

public

Get and return all speech recordings in a specific speech challenge from the current active Organisation derived from the OAuth2 scope.

public

Get and return all top level categories which do not have a parent Category.

public

getUser(userId: string): Promise<User>

Get a user in the current active Organisation derived from the OAuth2 scope.

public

Get and return all users in the current active Organisation derived from the OAuth2 scope.

public

Start a choice recognition from streaming audio.

public

Start a pronunciation analysis from streaming audio.

public

Start a speech recording from streaming audio.

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 _categoryController: * source

private _choiceChallengeController: * source

private _choiceRecognitionController: * source

private _connection: * source

private _emailCredentialsController: * source

private _groupController: * source

private _organisationController: * source

private _profileController: * source

private _progressController: * source

private _pronAnalaController: * source

private _pronChallController: * source

private _roleController: * source

private _speechChallengeController: * source

private _speechRecordingController: * source

private _userController: * source

Public Methods

public createCategory(category: Category): Promise<Category> source

Create a category.

Params:

NameTypeAttributeDescription
category Category

Object to create.

Return:

Promise<Category>

Promise containing the newly created Category.

Throw:

Promise.<Error>

category parameter of type "Category" is required.

Promise.<Error>

If the server returned an error.

public createChoiceChallenge(choiceChallenge: ChoiceChallenge): Promise<ChoiceChallenge> source

Create a choice challenge. The choice challenge will be created in the current active Organisation derived from the OAuth2 scope. It is necessary for a choice challenge to exist for a recording to be valid.

Params:

NameTypeAttributeDescription
choiceChallenge ChoiceChallenge

Object to create.

Return:

Promise<ChoiceChallenge>

Containing the newly created ChoiceChallenge.

Throw:

Promise.<Error>

If the server returned an error.

public createEmailCredentials(userId: string, emailCredentials: EmailCredentials): Promise<EmailCredentials> source

Register credentials to the given user. Multiple credentials can be registered to one user.

Params:

NameTypeAttributeDescription
userId string

The identifier of the user to register credentials to.

emailCredentials EmailCredentials

The credentials to register to the user.

Return:

Promise<EmailCredentials>

A promise containing the created EmailCredentials.

Throw:

Promise.<Error>

UserId parameter of type "string" is required.

Promise.<Error>

EmailCredentials parameter of type "EmailCredentials" is required.

Promise.<Error>

If the server returned an error.

public createGroup(group: Organisation): Promise<Group> source

Create a group. The group will be part of the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
group Organisation

Object to create.

Return:

Promise<Group>

Promise containing the newly created Group.

Throw:

Promise.<Error>

organisation parameter of type "Group" is required.

Promise.<Error>

If the server returned an error.

public createOrganisation(organisation: Organisation): Promise<Organisation> source

Create an organisation. The organisation will be owned by the current active tenant.

Params:

NameTypeAttributeDescription
organisation Organisation

Object to create.

Return:

Promise<Organisation>

Promise containing the newly created Organisation.

Throw:

Promise.<Error>

organisation field of type "Organisation" is required.

Promise.<Error>

If the server returned an error.

public createPronunciationChallenge(challenge: PronunciationChallenge): Promise<PronunciationChallenge> source

Create a pronunciation challenge. The created challenge will be part of the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challenge PronunciationChallenge

Object to create..

Return:

Promise<PronunciationChallenge>

Promise containing the newly created PronunciationChallenge.

Throw:

Promise.<Error>

PronunciationChallenge#referenceAudio of type "Blob" is required.

Promise.<Error>

If the server returned an error.

public createSpeechChallenge(speechChallenge: SpeechChallenge, audioBlob: Blob): Promise<PronunciationChallenge> source

Create a speech challenge in the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
speechChallenge SpeechChallenge

Object to create.

audioBlob Blob
  • nullable: true

Audio fragment to link to the challenge.

Return:

Promise<PronunciationChallenge>

Promise containing the newly created SpeechChallenge.

Throw:

Promise.<Error>

If the server returned an error.

public createUser(user: User): Promise<User> source

Create a user. The user will be created in the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
user User

User to create.

Return:

Promise<User>

Promise containing the newly created User.

Throw:

Promise.<Error>

user parameter of type "User" is required.

Promise.<Error>

If the server returned an error.

public deletePronunciationChallenge(challengeId: string): Promise<PronunciationChallenge> source

Delete a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

A pronunciation challenge identifier.

Return:

Promise<PronunciationChallenge>

Promise containing the given challenge ID.

Throw:

Promise.<Error>

PronunciationChallenge#id field is required.

Promise.<Error>

If the server returned an error.

public getCategoriesWithParent(parentId: string): Promise<Category[]> source

Get and return all categories which have a specific category as parent.

Params:

NameTypeAttributeDescription
parentId string

Specify a category parent identifier.

Return:

Promise<Category[]>

Promise containing an array of Categories.

Throw:

Promise.<Error>

parentId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getCategory(categoryId: string): Promise<Category> source

Get a category.

Params:

NameTypeAttributeDescription
categoryId string

Specify a category identifier.

Return:

Promise<Category>

Promise containing an Category.

Throw:

Promise.<Error>

categoryId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getChoiceChallenge(challengeId: string): Promise<ChoiceChallenge> source

Get a choice challenge. A choice challenge is identified by its identifier and the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a choice challenge identifier.

Return:

Promise<ChoiceChallenge>

Containing a ChoiceChallenge.

Throw:

Promise.<Error>

ChoiceChallenge#id field is required.

Promise.<Error>

If no result could not be found.

public getChoiceChallenges(): Promise<ChoiceChallenge[]> source

Get and return all choice challenges in the current active Organisation derived from the OAuth2 scope.

Return:

Promise<ChoiceChallenge[]>

Containing an array of ChoiceChallenges.

Throw:

Promise.<Error>

If no result could not be found.

public getChoiceRecognition(challengeId: string, recognitionId: string): Promise<ChoiceRecognition> source

Get a choice recognition in a choice challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a choice challenge identifier.

recognitionId string

Specify a choice recognition identifier.

Return:

Promise<ChoiceRecognition>

Promise containing a ChoiceRecognition.

Throw:

Promise.<Error>

ChoiceChallenge#id field is required.

Promise.<Error>

ChoiceRecognition#id field is required.

Promise.<Error>

If no result could not be found.

public getChoiceRecognitions(challengeId: string): Promise<ChoiceRecognition[]> source

Get and return all choice recognitions in a specific ChoiceChallenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a choice challenge to list speech recognitions for.

Return:

Promise<ChoiceRecognition[]>

Promise containing an array of ChoiceRecognitions.

Throw:

Promise.<Error>

ChoiceChallenge#id is required.

Promise.<Error>

If no result could not be found.

public getCurrentUser(): Promise<User> source

Get the current authenticated user.

Return:

Promise<User>

The current authenticated user.

Throw:

Promise.<Error>

If something went wrong in the server.

public getGroup(groupId: string): Promise<Group> source

Get a group which is part of the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
groupId string

Specify a group identifier.

Return:

Promise<Group>

Promise containing an Group.

Throw:

Promise.<Error>

groupId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getGroups(): Promise<Group[]> source

Get and return all groups in the current active Organisation derived from the OAuth2 scope.

Return:

Promise<Group[]>

Promise containing an array of Groups.

Throw:

Promise.<Error>

If no result could not be found.

public getOrganisation(organisationId: string): Promise<Organisation> source

Get an organisation. You can only get an organisation the current tenant is the owner of.

Params:

NameTypeAttributeDescription
organisationId string

Specify an organisation identifier.

Return:

Promise<Organisation>

Promise containing an Organisation.

Throw:

Promise.<Error>

Organisation#id field of type "string" is required.

Promise.<Error>

If no result could not be found.

public getOrganisations(): Promise<Organisation[]> source

Get and return all organisations the current tenant is the owner of.

Return:

Promise<Organisation[]>

Promise containing an array of Organisations.

Throw:

Promise.<Error>

If no result could not be found.

public getProfile(userId: string): Promise<Profile> source

Get the profile of the given user active in the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
userId string

Specify a User identifier.

Return:

Promise<Profile>

Promise containing a Profile.

Throw:

Promise.<Error>

userId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getProfiles(): Promise<Profile[]> source

Get and return all profiles of all users in the current active Organisation derived from the OAuth2 scope.

Return:

Promise<Profile[]>

Array of Profiles.

Throw:

Promise.<Error>

If the server returned an error.

public getProgress(categoryId: string, groupId: string, roles: Array): Promise<Progress[]> source

Get and return progress on the requested {@Link Category} for the current {@Link User} derived from the OAuth2 scope. The progress wil be returned for the current user. If a user is eligible to see the progress of more user, that progress is returned as well.

It is also possible to obtain the progress for the members of a given group.

Params:

NameTypeAttributeDescription
categoryId string

Specify a Category identifier.

groupId string
  • optional

Optionally specify the group identifier.

roles Array
  • optional

Optionally specify user roles to filter.

Return:

Promise<Progress[]>

Array of Progress.

Throw:

Promise.<Error>

categoryId parameter of type "string" is required.

Promise.<Error>

If the server returned an error.

public getPronunciationAnalyses(challengeId: string, detailed: boolean): Promise<PronunciationAnalysis[]> source

Get and return all pronunciation analyses in a specific pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a pronunciation challenge identifier to list speech recordings for.

detailed boolean
  • optional
  • default: false

Returns extra analysis metadata when true.

Return:

Promise<PronunciationAnalysis[]>

Promise containing an array PronunciationAnalyses.

Throw:

Promise.<Error>

PronunciationChallenge#id field is required.

Promise.<Error>

If no result could not be found.

public getPronunciationAnalysis(challengeId: string, analysisId: string): Promise<PronunciationAnalysis> source

Get a pronunciation analysis in a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a pronunciation challenge identifier.

analysisId string

Specify a pronunciation analysis identifier.

Return:

Promise<PronunciationAnalysis>

Promise containing a PronunciationAnalysis.

Throw:

Promise.<Error>

PronunciationChallenge#id field is required.

Promise.<Error>

PronunciationAnalysis#id field is required.

Promise.<Error>

If no result could not be found.

public getPronunciationChallenge(challengeId: string): Promise<PronunciationChallenge> source

Get a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a pronunciation challenge identifier.

Return:

Promise<PronunciationChallenge>

Promise containing a PronunciationChallenge.

Throw:

Promise.<Error>

PronunciationChallenge#id field is required.

Promise.<Error>

If no result could not be found.

public getPronunciationChallenges(): Promise<PronunciationChallenge[]> source

Get and return all pronunciation challenges in the current active Organisation derived from the OAuth2 scope.

Return:

Promise<PronunciationChallenge[]>

Promise containing an array of PronunciationChallenges.

Throw:

Promise.<Error>

If no result could not be found.

public getRole(roleId: string): Promise<Role> source

Get a single role.

Params:

NameTypeAttributeDescription
roleId string

Identifier of the role.

Return:

Promise<Role>

Promise containing a Role.

Throw:

Promise.<Error>

roleId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getRoles(): Promise<Role[]> source

Get and return all roles available in the API.

Return:

Promise<Role[]>

Promise containing an array of Roles.

Throw:

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.

Params:

NameTypeAttributeDescription
challengeId string

Specify a speech challenge identifier.

Return:

Promise<PronunciationChallenge>

Promise containing a SpeechChallenge.

Throw:

Promise.<Error>

SpeechChallenge#id field 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.

public getSpeechRecording(challengeId: string, recordingId: string): Promise<SpeechRecording> source

Get a speech recording in a speech challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a speech challenge identifier.

recordingId string

Specify a speech recording identifier.

Return:

Promise<SpeechRecording>

Promise containing a SpeechRecording.

Throw:

Promise.<Error>

SpeechChallenge#id field is required.

Promise.<Error>

SpeechRecording#id field is required.

Promise.<Error>

If no result could not be found.

public getSpeechRecordings(challengeId: string): Promise<SpeechRecording[]> source

Get and return all speech recordings in a specific speech challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a speech challenge identifier to list speech recordings for.

Return:

Promise<SpeechRecording[]>

Promise containing an array of SpeechRecordings.

Throw:

Promise.<Error>

SpeechChallenge#id is required.

Promise.<Error>

If no result could not be found.

public getTopLevelCategories(groupId: string): Promise<Category[]> source

Get and return all top level categories which do not have a parent Category.

Params:

NameTypeAttributeDescription
groupId string
  • optional

The ID of the group for which to fetch all top level categories.

Return:

Promise<Category[]>

Promise containing an array of Categories.

Throw:

Promise.<Error>

If no result could not be found.

public getUser(userId: string): Promise<User> source

Get a user in the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
userId string

Specify a user identifier.

Return:

Promise<User>

Promise containing a User.

Throw:

Promise.<Error>

userId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getUsers(): Promise<User[]> source

Get and return all users in the current active Organisation derived from the OAuth2 scope.

Return:

Promise<User[]>

Promise containing an array of Users.

Throw:

Promise.<Error>

If no result could not be found.

public startStreamingChoiceRecognition(challenge: ChoiceChallenge, recorder: AudioRecorder, trim: boolean): Promise<ChoiceRecognition> source

Start a choice recognition from streaming audio.

Params:

NameTypeAttributeDescription
challenge ChoiceChallenge

The choice challenge to perform.

recorder AudioRecorder

The audio recorder to extract audio from.

trim boolean
  • optional
  • default: true

Whether to trim the start and end of recorded audio.

Emit:

string

'ReadyToReceive' when the call is made to receive audio. The recorder can now send audio.

Throw:

Promise.<Error>

ChoiceChallenge parameter is required or invalid.

Promise.<Error>

ChoiceChallenge#id field is required.

Promise.<Error>

If the connection is not open.

Promise.<Error>

If the recorder is already recording.

Promise.<Error>

If a recognition session is already in progress.

Promise.<Error>

If something went wrong during analysis.

public startStreamingPronunciationAnalysis(challenge: PronunciationChallenge, recorder: AudioRecorder, trim: boolean): Promise<PronunciationAnalysis> source

Start a pronunciation analysis from streaming audio.

Params:

NameTypeAttributeDescription
challenge PronunciationChallenge

The pronunciation challenge to perform.

recorder AudioRecorder

The audio recorder to extract audio from.

trim boolean
  • optional

Whether to trim the start and end of recorded audio (default: true).

Emit:

string

'ReadyToReceive' when the call is made to receive audio. The recorder can now send audio.

Object

When the sent audio has finished alignment. Aligning audio is the process of mapping the audio to spoken words and determining when what is said. An object is sent containing a property 'progress', which is the sent audio alignment, and a property 'referenceAlignment' which is the alignment of the reference audio.

Throw:

Promise.<Error>

If challenge is not an object or not defined.

Promise.<Error>

If challenge has no id.

Promise.<Error>

If the connection is not open.

Promise.<Error>

If the recorder is already recording.

Promise.<Error>

If a session is already in progress.

Promise.<Error>

If something went wrong during analysis.

public startStreamingSpeechRecording(challenge: SpeechChallenge, recorder: AudioRecorder): Promise<SpeechRecording> source

Start a speech recording from streaming audio.

Params:

NameTypeAttributeDescription
challenge SpeechChallenge

The speech challenge to perform.

recorder AudioRecorder

The audio recorder to extract audio from.

Emit:

string

'ReadyToReceive' when the call is made to receive audio. The recorder can now send audio.

Throw:

Promise.<Error>

If challenge is not an object or not defined.

Promise.<Error>

If challenge has no id.

Promise.<Error>

If the connection is not open.

Promise.<Error>

If the recorder is already recording.

Promise.<Error>

If a session is already in progress.

Promise.<Error>

If something went wrong during recording.