ThreadViewWorld extension
The writes and reads of the thread view (brief M4-20 Scope): capabilities, main threads,
operators, revisions, pins, templates, threads from a message, title, close, reopen, move
and mark unread. Each write appends the event of 05 section 6 like the other writes of the
world; the checks are the visibility, the level and the capability manage where 05 names
it, nothing else (README).
Example:
world.grantCapability(alex.id, channel, 'manage');
world.pin(alex.id, messageId, pinned: true);
- on
Methods
-
addMainThread(
String channelId, {required String createdBy}) → String -
Available on FakeWorld, provided by the ThreadViewWorld extension
Adds the main thread (kind = main) of the text channelchannelId, names it in the channel'smain_thread_idand returns its ID. -
addTemplate(
{required String scope, required String name, required String contentMd, String? ownerId, String? channelId}) → JsonMap -
Available on FakeWorld, provided by the ThreadViewWorld extension
Adds a template ofscope(personalofownerId, orchannelofchannelId) and returns it. -
channelTemplates(
String principalId, String channelId) → List< JsonMap> -
Available on FakeWorld, provided by the ThreadViewWorld extension
listTemplates: the templates ofchannelIdwhenprincipalIdsees it. -
createThreadFromMessage(
String principalId, String channelId, JsonMap body) → JsonMap -
Available on FakeWorld, provided by the ThreadViewWorld extension
createThreadwithparent_message_id: a thread from a message of the main thread of a text channel, titled from the message (title_source = auto), with an optional first message. Returns the APIThreadCreated. -
grantCapability(
String principalId, String channelId, String capability) → void -
Available on FakeWorld, provided by the ThreadViewWorld extension
GivesprincipalIdthe capabilitycapability(APICapability) inchannelId. -
markUnread(
String principalId, String threadId, int lastRead, int expectedVersion, {String? deviceId}) → JsonMap -
Available on FakeWorld, provided by the ThreadViewWorld extension
markThreadUnread: moves the read position ofprincipalIdinthreadIdback tolastReadwhenexpectedVersionis the version of its read state (04 14), and appendsread_state.updated. Throws412 version_conflictwith the current state. -
moveThread(
String principalId, String threadId, String targetChannelId) → JsonMap -
Available on FakeWorld, provided by the ThreadViewWorld extension
moveThread: movesthreadIdintotargetChannelId(05thread.move:manageon source and target; the same effective operator, else422 operator_mismatch); the ID stays andthread.movednames the source channel. -
operatorOf(
String threadId) → String? -
Available on FakeWorld, provided by the ThreadViewWorld extension
The effective operator of the threadthreadId: its own operator, else its channel's. -
personalTemplates(
String principalId) → List< JsonMap> -
Available on FakeWorld, provided by the ThreadViewWorld extension
listMyTemplates: the personal templates ofprincipalId. -
pin(
String principalId, String messageId, {required bool pinned}) → void -
Available on FakeWorld, provided by the ThreadViewWorld extension
pinMessageandunpinMessage: pins or unpinsmessageId(05pin.create,pin.delete:manage); a repeat changes nothing. Throws404,403 forbiddenwithoutmanage,410 message_deletedfor a deleted message. -
pinsOf(
String principalId, String threadId) → List< JsonMap> -
Available on FakeWorld, provided by the ThreadViewWorld extension
listPins: the pins ofthreadId. -
revisionsOf(
String principalId, String messageId) → List< JsonMap> -
Available on FakeWorld, provided by the ThreadViewWorld extension
listMessageRevisions: the earlier revisions ofmessageId, oldest first. -
setOperator(
String channelId, String? agentId) → void -
Available on FakeWorld, provided by the ThreadViewWorld extension
Sets the effective operator ofchannelIdtoagentId(null: no operator). -
setThreadState(
String principalId, String threadId, {required bool closed}) → JsonMap -
Available on FakeWorld, provided by the ThreadViewWorld extension
closeThreadandreopenThreadofprincipalId(05:write); a thread already in the state changes nothing. Returns the thread. -
setTitle(
String principalId, String threadId, int expectedVersion, String title) → JsonMap -
Available on FakeWorld, provided by the ThreadViewWorld extension
setThreadTitle: setstitlewithtitle_source = manualwhenexpectedVersionis the thread's version, and appendsthread.updated. Throws412 version_conflict.