ChatsDataSource
Defined in: js-api/src/dapi.ts:2607
Chats API (grok.dapi.chats). A chat on entities is visible to whoever can view one of them;
mentioning a user in a comment (user.toMarkup() in the text) notifies them, and makes them watch
the chat, if they can see it.
Constructors
Constructor
new ChatsDataSource():
ChatsDataSource
Returns
ChatsDataSource
Methods
comments()
comments(
chatId):Promise<ChatComment[]>
Defined in: js-api/src/dapi.ts:2629
The comments of the chat, oldest first; empty when it does not exist or the current user cannot see it.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
Returns
Promise<ChatComment[]>
deleteComment()
deleteComment(
commentId):Promise<void>
Defined in: js-api/src/dapi.ts:2656
Deletes a comment: the author's own, or any with the DeleteComments permission.
Parameters
| Parameter | Type |
|---|---|
commentId | string |
Returns
Promise<void>
edit()
edit(
chatId,commentId,text,options?):Promise<ChatComment>
Defined in: js-api/src/dapi.ts:2643
Replaces the text of a comment of the current user's, and its references when [options.refs] is given (otherwise it keeps its non-entity references); the comment is marked edited.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
commentId | string |
text | string |
options? | { refs?: ChatCommentRef[]; } |
options.refs? | ChatCommentRef[] |
Returns
Promise<ChatComment>
find()
find(
chatId):Promise<ChatInfo|null>
Defined in: js-api/src/dapi.ts:2624
The chat, or null when it does not exist or the current user cannot see it.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
Returns
Promise<ChatInfo | null>
forEntity()
forEntity(
entityId):Promise<ChatInfo[]>
Defined in: js-api/src/dapi.ts:2614
The chats attached to the entity, and those whose comments reference it, most recently active first.
Parameters
| Parameter | Type |
|---|---|
entityId | string |
Returns
Promise<ChatInfo[]>
forRef()
forRef(
ref):Promise<ChatInfo[]>
Defined in: js-api/src/dapi.ts:2619
The chats whose comments carry the reference [ref], most recently active first.
Parameters
| Parameter | Type |
|---|---|
ref | string |
Returns
Promise<ChatInfo[]>
import()
import(
chatId,text,options?):Promise<ChatComment>
Defined in: js-api/src/dapi.ts:2649
Posts a comment with its original author and date, sending no notifications; requires the ImportComments permission.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
text | string |
options? | IChatImportOptions |
Returns
Promise<ChatComment>
isWatched()
isWatched(
chatId):Promise<boolean>
Defined in: js-api/src/dapi.ts:2671
Whether the current user watches the chat.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
Returns
Promise<boolean>
post()
post(
chatId,text,options?):Promise<ChatComment>
Defined in: js-api/src/dapi.ts:2634
Posts a comment, creating the chat on its first one.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
text | string |
options? | IChatPostOptions |
Returns
Promise<ChatComment>
unwatch()
unwatch(
chatId):Promise<void>
Defined in: js-api/src/dapi.ts:2666
Unsubscribes the current user from the chat; a mention no longer subscribes them again.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
Returns
Promise<void>
watch()
watch(
chatId):Promise<void>
Defined in: js-api/src/dapi.ts:2661
Subscribes the current user to the chat's new comments.
Parameters
| Parameter | Type |
|---|---|
chatId | string |
Returns
Promise<void>
domainRowRef()
staticdomainRowRef(schema,table,rowId):string
Defined in: js-api/src/dapi.ts:2609
The reference to a row of a domain table, promoted or not, for ChatCommentRef.ref.
Parameters
| Parameter | Type |
|---|---|
schema | string |
table | string |
rowId | string |
Returns
string