Skip to main content

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​

ParameterType
chatIdstring

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​

ParameterType
commentIdstring

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​

ParameterType
chatIdstring
commentIdstring
textstring
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​

ParameterType
chatIdstring

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​

ParameterType
entityIdstring

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​

ParameterType
refstring

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​

ParameterType
chatIdstring
textstring
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​

ParameterType
chatIdstring

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​

ParameterType
chatIdstring
textstring
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​

ParameterType
chatIdstring

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​

ParameterType
chatIdstring

Returns​

Promise<void>


domainRowRef()​

static domainRowRef(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​

ParameterType
schemastring
tablestring
rowIdstring

Returns​

string