import { type WikiPageRevision as WikiPageRevisionProto, type WikiPageSettings_Data } from '@devvit/protos/json/devvit/plugin/redditapi/wiki/wiki_msg.js'; import { T2 } from '@devvit/shared-types/tid.js'; import { Listing, type ListingFetchOptions } from './Listing.js'; import { User } from './User.js'; /** * WikiVersion represents different wikis that an app can manage. The wiki versions operate independently: editing a page in one version will not * edit the same page in the other version. * * v1 is the wiki seen in old reddit. Enabled in all subreddits by default. The `'config/'` pages are only available in v1, and attempting to access those in v2 will * throw an error. * * v2 is the wiki seen in redit.com and the mobile apps. Call reddit.isWikiV2Enabled(subreddit) to check if a subreddit supports V2 wikis. */ export type WikiVersion = 'v1' | 'v2'; export type WikiVersionOptions = { /** Which wiki version to target. Defaults to `'v1'`. */ wikiVersion?: WikiVersion; }; export type CreateWikiPageOptions = WikiVersionOptions & { /** The name of the subreddit to create the page in. */ subredditName: string; /** The name of the page to create. */ page: string; /** The content of the page. */ content: string; /** The reason for creating the page. */ reason?: string; }; export type UpdateWikiPageOptions = WikiVersionOptions & { /** The name of the subreddit the page is in. */ subredditName: string; /** The name of the page to update. */ page: string; /** The new content of the page. */ content: string; /** The reason for updating the page. */ reason?: string | undefined; }; export type GetPageRevisionsOptions = Omit & WikiVersionOptions & { /** The name of the subreddit the page is in. */ subredditName: string; /** The name of the page to get revisions for. */ page?: string; }; export declare enum WikiPagePermissionLevel { /** Use subreddit wiki permissions */ SUBREDDIT_PERMISSIONS = 0, /** Only approved wiki contributors for this page may edit */ APPROVED_CONTRIBUTORS_ONLY = 1, /** Only mods may edit and view */ MODS_ONLY = 2 } export type UpdatePageSettingsOptions = WikiVersionOptions & { /** The name of the subreddit the page is in. */ subredditName: string; /** The name of the page to update settings for. */ page: string; /** Whether the page should be listed in the wiki index. */ listed: boolean; /** The permission level for the page. */ permLevel: WikiPagePermissionLevel; }; /** The revision ID is a v4 UUID */ export type WikiPageRevisionId = `${string}-${string}-${string}-${string}-${string}`; export type GetWikiPageOptions = WikiVersionOptions & { /** The revision ID of the wiki page version to retrieve. */ revisionId?: WikiPageRevisionId; }; export declare class WikiPage { #private; /** The name of the page. */ get name(): string; /** The name of the subreddit the page is in. */ get subredditName(): string; /** The wiki version this page belongs to. */ get wikiVersion(): WikiVersion; /** The Markdown content of the page. */ get content(): string; /** The HTML content of the page. */ get contentHtml(): string; /** The ID of the revision. */ get revisionId(): WikiPageRevisionId; /** The date of the revision. */ get revisionDate(): Date; /** The reason for the revision. */ get revisionReason(): string; /** The ID of the author of this revision. */ get revisionAuthorId(): T2 | undefined; /** * The author of this revision. * * @deprecated Use revisionAuthorId instead. */ get revisionAuthor(): User | undefined; toJSON(): Pick & { revisionAuthorId: T2 | undefined; /** @deprecated Use revisionAuthorId instead. */ revisionAuthor: ReturnType | undefined; }; /** Update this page. */ update(content: string, reason?: string): Promise; /** Get the revisions for this page. */ getRevisions(options: Omit): Promise>; /** Revert this page to a previous revision. */ revertTo(revisionId: WikiPageRevisionId): Promise; /** Get the settings for this page. */ getSettings(): Promise; /** Update the settings for this page. */ updateSettings(options: Omit): Promise; /** Add an editor to this page. */ addEditor(username: string): Promise; /** Remove an editor from this page. */ removeEditor(username: string): Promise; } export declare class WikiPageRevision { #private; constructor(data: WikiPageRevisionProto, wikiVersion?: WikiVersion); get id(): string; get page(): string; get date(): Date; /** The ID of the author of this revision. */ get authorId(): T2 | undefined; /** * The author of this revision. * * @deprecated Use authorId instead. */ get author(): User; get reason(): string; get hidden(): boolean; toJSON(): Pick & { authorId: T2 | undefined; /** @deprecated Use authorId instead. */ author: ReturnType | undefined; }; } export declare class WikiPageSettings { #private; constructor(data: WikiPageSettings_Data, wikiVersion?: WikiVersion); get listed(): boolean; get permLevel(): WikiPagePermissionLevel; /** The IDs of users who may edit this page. */ get editorIds(): T2[]; /** @deprecated Use editorIds instead. */ get editors(): User[]; toJSON(): Pick & { editorIds: T2[]; /** @deprecated Use editorIds instead. */ editors: ReturnType[]; }; } //# sourceMappingURL=WikiPage.d.ts.map