Class: ConversationClient
Defined in: voxit-web-client.js:525
The ConversationClient class is a client for interacting with a conversation.
Constructors
new ConversationClient()
new ConversationClient(
baseURL,
conversationID,
translations?): ConversationClient
Defined in: voxit-web-client.js:542
The constructor returns a newly created ConversationClient object.
Parameters
baseURL
The base URL of the server.
string | URL
conversationID
string
The identifier for a conversation.
translations?
string[] = []
The requested translations of a conversation.
Returns
Properties
authenticated
authenticated: boolean;
Defined in: voxit-web-client.js:579
Whether the client is authenticated.
authenticationRequired
authenticationRequired: boolean;
Defined in: voxit-web-client.js:581
Whether the server requires authentication.
baseURL
baseURL: URL;
Defined in: voxit-web-client.js:554
The base URL of the server.
conversation
conversation: Conversation;
Defined in: voxit-web-client.js:584
The conversation.
conversationID
conversationID: string;
Defined in: voxit-web-client.js:556
The identifier for the conversation.
loginURL
loginURL: URL;
Defined in: voxit-web-client.js:566
The URL for starting the authentication process. In case authentication is required and the participant is not authenticated the authentication process can be started by opening this URL in a popup window.
participant
participant: Participant;
Defined in: voxit-web-client.js:591
The participant.
results
results: Results;
Defined in: voxit-web-client.js:593
The voting results if available.
statements
statements: Map<number, Statement>;
Defined in: voxit-web-client.js:589
The statements of the conversation.
translations
translations: string[];
Defined in: voxit-web-client.js:558
The requested translations for a conversation.
Methods
addStatement()
addStatement(text, options?): Promise<void>
Defined in: voxit-web-client.js:899
The addStatement method ads a new statement. The statement text must be unique to the conversation.
Parameters
text
string
The statement text.
options?
Options to configure the underlying request.
signal?
AbortSignal
AbortSignal for canceling the request.
Returns
Promise<void>
addVote()
addVote(
statementID,
value,
options?): Promise<void>
Defined in: voxit-web-client.js:881
The addVote method adds a vote for the given statement. A participant may vote multiple times for the same statement, however only the last vote will be counted.
Parameters
statementID
ID of the statement for which the vote cast.
string | number
value
number
Value representing the vote.
options?
Options to configure the underlying request.
signal?
AbortSignal
AbortSignal for canceling the request.
Returns
Promise<void>
currentStatement()
currentStatement(): null | Statement
Defined in: voxit-web-client.js:997
The currentStatement method returns the current statement. Unauthenticated participants receive the first seed statement, preferably a non-meta statement, if there are no seed statements at all this will return null. Authenticated participants get the first statement which is not their own and which they have not voted on. If there are no more statements this will return null.
Returns
null | Statement
init()
init(options?): Promise<void>
Defined in: voxit-web-client.js:947
The init method initializes the conversation client and initially loads the conversation. It must als be called to update the client after successful authentication.
Parameters
options?
Options to configure the underlying request.
signal?
AbortSignal
AbortSignal for canceling the request.
Returns
Promise<void>
pollResults()
pollResults(options?): Promise<boolean>
Defined in: voxit-web-client.js:823
The pollResults method polls the server for new voting results and updates the results property accordingly. The availabilty of new results is indicated by the returned promise resolving to true.
Parameters
options?
Options to configure the underlying request.
signal?
AbortSignal
AbortSignal for canceling the request.
Returns
Promise<boolean>
Promise object indicating whether there are new results.
pollStatements()
pollStatements(options?): Promise<boolean>
Defined in: voxit-web-client.js:798
The pollStatements polls the server for new statements and updates the statements property accordingly. The availabilty of new statements is indicated by the returned promise resolving to true.
Parameters
options?
Options to configure the underlying request.
signal?
AbortSignal
AbortSignal for canceling the request.
Returns
Promise<boolean>
setNotifications()
setNotifications(enabled, options?): Promise<void>
Defined in: voxit-web-client.js:926
The setNotifications method sets the notifications preferences.
Parameters
enabled
boolean
Whether notifications are enabled.
options?
Options to configure the underlying request.
signal?
AbortSignal
AbortSignal for canceling the request.
Returns
Promise<void>