Skip to content

Class: ConversationClient

Defined in: particiapp-web-client.js:480

The ConversationClient class is a client for interacting with a conversation.

Constructors

new ConversationClient()

new ConversationClient(baseURL, conversationID): ConversationClient

Defined in: particiapp-web-client.js:495

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.

Returns

ConversationClient

Properties

authenticated

authenticated: boolean;

Defined in: particiapp-web-client.js:530

Whether the client is authenticated.


authenticationRequired

authenticationRequired: boolean;

Defined in: particiapp-web-client.js:532

Whether the server requires authentication.


baseURL

baseURL: URL;

Defined in: particiapp-web-client.js:507

The base URL of the server.


conversation

conversation: Conversation;

Defined in: particiapp-web-client.js:535

The conversation.


conversationID

conversationID: string;

Defined in: particiapp-web-client.js:509

The identifier for the conversation.


loginURL

loginURL: URL;

Defined in: particiapp-web-client.js:517

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: particiapp-web-client.js:542

The participant.


results

results: Results;

Defined in: particiapp-web-client.js:544

The voting results if available.


statements

statements: Map<number, Statement>;

Defined in: particiapp-web-client.js:540

The statements of the conversation.

Methods

addStatement()

addStatement(text, options?): Promise<void>

Defined in: particiapp-web-client.js:846

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: particiapp-web-client.js:828

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: particiapp-web-client.js:941

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: particiapp-web-client.js:891

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: particiapp-web-client.js:770

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: particiapp-web-client.js:745

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: particiapp-web-client.js:870

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>