import AdministrativeSDK from 'itslanguage/administrative-sdk/administrative-sdk.js'
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 |
_connection: * |
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
Method Summary
Public Methods | ||
public |
createCategory(category: Category): Promise<Category> Create a category. |
|
public |
createChoiceChallenge(choiceChallenge: ChoiceChallenge): Promise<ChoiceChallenge> Create a choice challenge. |
|
public |
createEmailCredentials(userId: string, emailCredentials: EmailCredentials): Promise<EmailCredentials> Register credentials to the given user. |
|
public |
createGroup(group: Organisation): Promise<Group> Create a group. |
|
public |
createOrganisation(organisation: Organisation): Promise<Organisation> Create an organisation. |
|
public |
Create a pronunciation challenge. |
|
public |
createSpeechChallenge(speechChallenge: SpeechChallenge, audioBlob: Blob): Promise<PronunciationChallenge> Create a speech challenge in the current active Organisation derived from the OAuth2 scope. |
|
public |
createUser(user: User): Promise<User> Create a user. |
|
public |
deletePronunciationChallenge(challengeId: string): Promise<PronunciationChallenge> Delete a pronunciation challenge from the current active Organisation derived from the OAuth2 scope. |
|
public |
getCategoriesWithParent(parentId: string): Promise<Category[]> Get and return all categories which have a specific category as parent. |
|
public |
getCategory(categoryId: string): Promise<Category> Get a category. |
|
public |
getChoiceChallenge(challengeId: string): Promise<ChoiceChallenge> 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 |
getChoiceRecognitions(challengeId: string): Promise<ChoiceRecognition[]> 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 |
getOrganisation(organisationId: string): Promise<Organisation> Get an organisation. |
|
public |
Get and return all organisations the current tenant is the owner of. |
|
public |
getProfile(userId: string): Promise<Profile> Get the profile of the given user active in the current active Organisation derived from the OAuth2 scope. |
|
public |
getProfiles(): Promise<Profile[]> Get and return all profiles of all users in the current active Organisation derived from the OAuth2 scope. |
|
public |
Get and return progress on the requested {@Link Category} for the current {@Link User} derived from the OAuth2 scope. |
|
public |
getPronunciationAnalyses(challengeId: string, detailed: boolean): Promise<PronunciationAnalysis[]> Get and return all pronunciation analyses in a specific pronunciation challenge from the current active Organisation derived from the OAuth2 scope. |
|
public |
getPronunciationAnalysis(challengeId: string, analysisId: string): Promise<PronunciationAnalysis> Get a pronunciation analysis in a pronunciation challenge from the current active Organisation derived from the OAuth2 scope. |
|
public |
getPronunciationChallenge(challengeId: string): Promise<PronunciationChallenge> 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 |
Get a single role. |
|
public |
Get and return all roles available in the API. |
|
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 |
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 |
getSpeechRecordings(challengeId: string): Promise<SpeechRecording[]> Get and return all speech recordings in a specific speech challenge from the current active Organisation derived from the OAuth2 scope. |
|
public |
getTopLevelCategories(groupId: string): Promise<Category[]> Get and return all top level categories which do not have a parent Category. |
|
public |
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 |
startStreamingChoiceRecognition(challenge: ChoiceChallenge, recorder: AudioRecorder, trim: boolean): Promise<ChoiceRecognition> Start a choice recognition from streaming audio. |
|
public |
startStreamingPronunciationAnalysis(challenge: PronunciationChallenge, recorder: AudioRecorder, trim: boolean): Promise<PronunciationAnalysis> Start a pronunciation analysis from streaming audio. |
|
public |
startStreamingSpeechRecording(challenge: SpeechChallenge, recorder: AudioRecorder): Promise<SpeechRecording> Start a speech recording from streaming audio. |
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 _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:
Name | Type | Attribute | Description |
category | Category | Object to create. |
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:
Name | Type | Attribute | Description |
choiceChallenge | ChoiceChallenge | Object to create. |
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:
Name | Type | Attribute | Description |
userId | string | The identifier of the user to register credentials to. |
|
emailCredentials | EmailCredentials | The credentials to register to the user. |
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:
Name | Type | Attribute | Description |
group | Organisation | Object to create. |
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:
Name | Type | Attribute | Description |
organisation | Organisation | Object to create. |
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:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
speechChallenge | SpeechChallenge | Object to create. |
|
audioBlob | Blob |
|
Audio fragment to link to the challenge. |
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:
Name | Type | Attribute | Description |
user | User | User to create. |
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:
Name | Type | Attribute | Description |
challengeId | string | A pronunciation challenge identifier. |
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:
Name | Type | Attribute | Description |
parentId | string | Specify a category parent identifier. |
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:
Name | Type | Attribute | Description |
categoryId | string | Specify a category identifier. |
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:
Name | Type | Attribute | Description |
challengeId | string | Specify a choice challenge identifier. |
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.
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.
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:
Name | Type | Attribute | Description |
challengeId | string | Specify a choice challenge to list speech recognitions for. |
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.
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:
Name | Type | Attribute | Description |
groupId | string | Specify a group identifier. |
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.
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:
Name | Type | Attribute | Description |
organisationId | string | Specify an organisation identifier. |
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.
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:
Name | Type | Attribute | Description |
userId | string | Specify a User identifier. |
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.
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.
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.
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.
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:
Name | Type | Attribute | Description |
challengeId | string | Specify a pronunciation challenge identifier. |
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.
Throw:
Promise.<Error> |
If no result could not be found. |
public getRole(roleId: string): Promise<Role> source
Get a single role.
Params:
Name | Type | Attribute | Description |
roleId | string | Identifier of the 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.
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:
Name | Type | Attribute | Description |
challengeId | string | Specify a speech challenge identifier. |
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.
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.
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:
Name | Type | Attribute | Description |
challengeId | string | Specify a speech challenge identifier to list speech recordings for. |
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:
Name | Type | Attribute | Description |
groupId | string |
|
The ID of the group for which to fetch all top level 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:
Name | Type | Attribute | Description |
userId | string | Specify a user identifier. |
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.
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:
Name | Type | Attribute | Description |
challenge | ChoiceChallenge | The choice challenge to perform. |
|
recorder | AudioRecorder | The audio recorder to extract audio from. |
|
trim | boolean |
|
Whether to trim the start and end of recorded audio. |
Return:
Promise<ChoiceRecognition> | A https://github.com/cujojs/when Promise containing a ChoiceRecognition. |
Emit:
'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:
Name | Type | Attribute | Description |
challenge | PronunciationChallenge | The pronunciation challenge to perform. |
|
recorder | AudioRecorder | The audio recorder to extract audio from. |
|
trim | boolean |
|
Whether to trim the start and end of recorded audio (default: true). |
Return:
Promise<PronunciationAnalysis> | A https://github.com/cujojs/when Promise containing a PronunciationAnalysis. |
Emit:
'ReadyToReceive' when the call is made to receive audio. The recorder can now send audio. |
|
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:
Name | Type | Attribute | Description |
challenge | SpeechChallenge | The speech challenge to perform. |
|
recorder | AudioRecorder | The audio recorder to extract audio from. |
Return:
Promise<SpeechRecording> | A https://github.com/cujojs/when Promise containing a SpeechRecording. |
Emit:
'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. |