moderator-toolbox-nxg-for-reddit / modules/announcements/publish
modules/announcements/publish¶
Functions¶
getAnnouncements()¶
getAnnouncements():
Promise<ListResult>
Defined in: extension/data/modules/announcements/publish.ts:49
Returns all announcement notes currently on the wiki (newest first).
Mirrors the write path’s refusal semantics: a page the codec cannot interpret
(invalid JSON or an unexpected schema) returns {ok: false, reason} rather than
pretending the page is empty.
Returns¶
Promise<ListResult>
publishAnnouncement()¶
publishAnnouncement(
note):Promise<PublishResult>
Defined in: extension/data/modules/announcements/publish.ts:64
Appends a new note to the wiki and writes the result back as valid JSON.
Parameters¶
note¶
Omit<AnnouncementNote, "id">
The note’s content, plus an optional publishAt (epoch seconds)
for scheduling. Its id is always assigned here from the live list;
publishAt defaults to now when the caller leaves it unset (publish now).
Returns¶
Promise<PublishResult>
removeAnnouncement()¶
removeAnnouncement(
id):Promise<WriteResult>
Defined in: extension/data/modules/announcements/publish.ts:134
Removes the note with the given id from the wiki.
Parameters¶
id¶
string
The id of the announcement to remove.
Returns¶
Promise<WriteResult>
updateAnnouncement()¶
updateAnnouncement(
id,note):Promise<WriteResult>
Defined in: extension/data/modules/announcements/publish.ts:97
Replaces the content of an existing note, identified by id. Refuses once the
note has gone live (its publishAt is at/before now) - only still-scheduled
announcements are editable. publishAt defaults to now when unset, so clearing
a schedule publishes immediately.
Parameters¶
id¶
string
The id of the announcement to edit.
note¶
Omit<AnnouncementNote, "id">
The replacement content.
Returns¶
Promise<WriteResult>
Type Aliases¶
ListResult¶
ListResult = {
notes:AnnouncementNote[];ok:true; } | {ok:false;reason:string; }
Defined in: extension/data/modules/announcements/publish.ts:30
Outcome of a list (read) attempt.
PublishResult¶
PublishResult = {
id:string;ok:true; } | {ok:false;reason:string; }
Defined in: extension/data/modules/announcements/publish.ts:25
Outcome of a publish attempt.
WriteResult¶
WriteResult = {
ok:true; } | {ok:false;reason:string; }
Defined in: extension/data/modules/announcements/publish.ts:35
Outcome of a mutation that returns no value (e.g. remove).