Finish writing the Query Manager wiki page

Oliver 2025-12-05 21:34:21 -07:00
parent 02c9c501f6
commit 7a3c3f065f

@ -19,12 +19,12 @@ The `resolve`, `onSubmit`, and `app` properties are removed from the
query data prior to being returned.
### `QueryManager.query`
> QueryManager.query(request: [AskConfig](/Dialog-Manager.md#askconfig), options: [QueryOptions](#queryoptions)): Promise<[QueryResponse](#queryresponse)>
> QueryManager.query(request: [AskConfig](Dialog-Manager.md#askconfig), options: [QueryOptions](#queryoptions)): Promise<[QueryResponse](#queryresponse)|null>
This is the powerhouse of the Query Manager API, this is how you actually
prompt other users for information and do stuff with that information.
The `request` parameter utilizes the same type as the [Dialog Manager's AskConfig](/Dialog-Manager.md#askconfig), please consult that documentation for further information.
The `request` parameter utilizes the same type as the [Dialog Manager's AskConfig](Dialog-Manager.md#askconfig), please consult that documentation for further information.
If you want to perform some operation on the data returned on a per-user basis as it arrives, you should provide the `options` an `onSubmit` event listener which will be called with each user's submitted data.
@ -34,18 +34,30 @@ If you want to perform some operation on the data returned on a per-user basis a
### `QueryManager.requery`
> QueryManager.requery(requestID: string, users: string[]): Promise&lt;void&gt;
Resends the request for the users specified. The `users` parameter is expected to be a non-empty list of user IDs.
This uses the cached request data associated with requestID which cannot be changed, in order to get differnet / followup information you must create a new query.
### `QueryManager.notify`
> QueryManager.notify(requestID: string, userID: string, content: string, options: [NotifyOptions](#notifyoptions)): Promise&lt;void&gt;
This is a helper function used to send a notification to a requestee when confirming that the data that they submitted went through successfully. The `content` parameter can be any HTML supported within chat messages.
### `QueryManager.finish`
> QueryManager.finish(requestID: string): Promise&lt;void&gt;
Closes a data request early, preventing any users from submitting responses. This resolves the Promise the original data request with the responses that have been submitted so far, and closing all of the in-progress forms on all connected clients.
### `QueryManager.cancel`
> QueryManager.cancel(requestID: string): Promise&lt;void&gt;
This method is identical to [QueryManager.finish](#querymanagerfinish), however this resolves the Promise with `null` *instead of* the responses.
### `QueryManager.setApplication`
> QueryManager.cancel(requestID: string, app: QueryStatus): Promise&lt;void&gt;
This method is used in order to add a QueryStatus application to a request when it was originally created with `showStatusApp=false`, this will not overwrite a status application that was already assigned to the request.
## Types
### QueryData
@ -58,8 +70,8 @@ If you want to perform some operation on the data returned on a per-user basis a
| `onSubmit` | `((requestID: string, userID: string, answers: object) => Promise<void>)?` | An event listener that processes each user's answers as they come in, this should send the user a notification with the confirmed result of the submission.
| `app` | `QueryStatus?` | The application that is presenting the current status of each requestee, and allowing the requestor to rerequest the data if the user disconnected or closed the dialog without submitting data.
| `status` | [UserStatus](#userstatus) | The status of each user.
| `request` | [AskConfig](/Dialog-Manager.md#askconfig) | The initial request data used to create the query. This is stored in order to be able to requery users when required.
| `config` | [AskOptions](/Dialog-Manager.md#askoptions) | The initial config used to create the query. This is stored in order to be able to requery users when required.
| `request` | [AskConfig](Dialog-Manager.md#askconfig) | The initial request data used to create the query. This is stored in order to be able to requery users when required.
| `config` | [AskOptions](Dialog-Manager.md#askoptions) | The initial config used to create the query. This is stored in order to be able to requery users when required.
### UserStatus
This is an object typing where the keys are user IDs and the values are one of the following values:
@ -72,7 +84,7 @@ This is an object typing where the keys are user IDs and the values are one of t
| `unprompted` | The user is connected to the game and is available to receive queries, however they may not have the dialog visible on the screen due reconnecting after a disconnect or for some other reason.
### QueryOptions
This type extends [AskOptions](/Dialog-Manager.md#askoptions), consult that documentation for more properties that can be used here.
This type extends [AskOptions](Dialog-Manager.md#askoptions), consult that documentation for more properties that can be used here.
| Property | Type | Description
| -------- | ---- | -----------
@ -81,6 +93,10 @@ This type extends [AskOptions](/Dialog-Manager.md#askoptions), consult that docu
| `showStatusApp` | `boolean?` | Whether or not to show the query status in a popup window for the requestor. If not provided, this defaults to true.
### QueryResponse
This is an object representing every user's queried data, this may or may not have all of the requested users within it, and should be treated as such. For the users that it does have data from, the value will be an object containing the same key-value pairs if you had provided the query to [`DialogManager.ask`](/Dialog-Manager.md#dialogmanagerask).
This is an object representing every user's queried data, this may or may not have all of the requested users within it, and should be treated as such. For the users that it does have data from, the value will be an object containing the same key-value pairs if you had provided the query to [`DialogManager.ask`](Dialog-Manager.md#dialogmanagerask).
### NotifyOptions
### NotifyOptions
| Property | Type | Description
| -------- | ---- | -----------
| `includeGM` | `boolean?` | Whether or not the user should include gamemasters and assistant gamemasters when creating the chat message with the notification. This defaults to `false`.