Wiki source code of Front-End API

Last modified by superadmin on 2026/05/29 12:07

Hide last authors
Manuel Leduc 7.1 1 == Note ==
Manuel Leduc 1.1 2
3 A legacy API introduced during the prototyping phase. The goal is to gradually break this API down into modular pieces until we can remove it.
4
Manuel Leduc 3.1 5 == Storage ==
Manuel Leduc 1.1 6
7 {{code language="typescript"}}
8 interface Storage {
9 setWikiConfig(config: WikiConfig): void;
10
11 getWikiConfig(): WikiConfig;
12
13 getPageRestURL(page: string, syntax: string, revision?: string): string;
14
15 getPageFromViewURL(url: string): string | null;
16
17 getImageURL(page: string, image: string): string;
18
19 /**
20 *
21 * @param page - the id of the request page
22 * @param syntax - the syntax of the request page
23 * @param revision - the revision requested, undefined will default to latest
24 * @param requeue - optional param informing whether an asynchronous update of
25 * the page content is allowed (default is true)
26 * @returns a promise wrapping a page data, or undefined in case of page not
27 * found
28 * @since 0.8
29 */
30 getPageContent(
31 page: string,
32 syntax: string,
33 revision?: string,
34 requeue?: boolean,
35 ): Promise<PageData | undefined>;
36
37 /**
38 * @param page - the page to get the attachments from
39 * @returns a promise wrapping an array of attachments and an optional count, or undefined if the
40 * requested page is not found
41 *
42 * @since 0.9
43 */
44 getAttachments(page: string): Promise<AttachmentsData | undefined>;
45
46 /**
47 * @param page - the attachment page name
48 * @param name - the attachment name
49 * @returns a promise wrapping the attachment data, or undefined if the requested attachment is not found
50 * @since 0.12
51 */
52 getAttachment(
53 page: string,
54 name: string,
55 ): Promise<PageAttachment | undefined>;
56
57 getPanelContent(
58 panel: string,
59 contextPage: string,
60 syntax: string,
61 ): Promise<PageData>;
62
63 getEditField(jsonArticle: object, fieldName: string): Promise<string>;
64
65 isStorageReady(): Promise<boolean>;
66
67 /**
68 * Update the content of a given page with the provided content.
69 *
70 * @param page - the page to save
71 * @param content - the content of the page
72 * @param title - the page title
73 * @param syntax - the syntax of the page
74 * @returns a promise when the save is done
75 *
76 * @since 0.8
77 */
78 save(
79 page: string,
80 title: string,
81 content: string,
82 syntax: string,
83 ): Promise<unknown>;
84
85 /**
86 * @param page - the serialized reference of the page
87 * @param files - the list of files to upload
88 * @returns (since 0.20) an optional list of resolved attachments URL (in the same order as the provided files). This
89 * is useful in the case where the url cannot be resolved from the name of the file and its document reference
90 * alone.
91 * @since 0.9
92 */
93 saveAttachments(
94 page: string,
95 files: File[],
96 ): Promise<undefined | (undefined | string)[]>;
97
98 /**
99 * Delete a page.
100 *
101 * @param page - the page to delete
102 * @returns true if the delete was successful, false with the reason otherwise
103 *
104 * @since 0.11
105 */
106 delete(page: string): Promise<{ success: boolean; error?: string }>;
107
108 /**
109 * Move a page.
110 *
111 * @param page - the page to move
112 * @param newPage - the new location for the page
113 * @param preserveChildren - whether to move children
114 * @returns true if the move was successful, false with the reason otherwise
115 *
116 * @since 0.14
117 */
118 move(
119 page: string,
120 newPage: string,
121 preserveChildren: boolean,
122 ): Promise<{ success: boolean; error?: string }>;
123 }
124
125 {{/code}}
126
127
128
129

Get Connected