@devvit/public-api 0.12.0-next-2025-04-30-5d2b49b36.0 → 0.12.0-next-2025-08-12-20-06-14-50f19bb3e.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/apis/AssetsClient/AssetsClient.d.ts +2 -2
  2. package/apis/AssetsClient/AssetsClient.d.ts.map +1 -1
  3. package/apis/AssetsClient/AssetsClient.js +5 -7
  4. package/apis/key-value-storage/KeyValueStorage.d.ts +1 -1
  5. package/apis/key-value-storage/KeyValueStorage.d.ts.map +1 -1
  6. package/apis/makeAPIClients.d.ts.map +1 -1
  7. package/apis/makeAPIClients.js +3 -0
  8. package/apis/media/MediaClient.js +1 -1
  9. package/apis/realtime/RealtimeClient.d.ts +1 -1
  10. package/apis/realtime/RealtimeClient.d.ts.map +1 -1
  11. package/apis/reddit/RedditAPIClient.d.ts +41 -41
  12. package/apis/reddit/RedditAPIClient.d.ts.map +1 -1
  13. package/apis/reddit/RedditAPIClient.js +150 -151
  14. package/apis/reddit/models/Comment.d.ts +4 -1
  15. package/apis/reddit/models/Comment.d.ts.map +1 -1
  16. package/apis/reddit/models/Comment.js +4 -1
  17. package/apis/reddit/models/Flair.d.ts +1 -1
  18. package/apis/reddit/models/Flair.d.ts.map +1 -1
  19. package/apis/reddit/models/Flair.js +2 -2
  20. package/apis/reddit/models/Listing.d.ts +1 -1
  21. package/apis/reddit/models/Listing.d.ts.map +1 -1
  22. package/apis/reddit/models/ModAction.d.ts +3 -0
  23. package/apis/reddit/models/ModAction.d.ts.map +1 -1
  24. package/apis/reddit/models/ModAction.js +1 -2
  25. package/apis/reddit/models/ModMail.d.ts +23 -23
  26. package/apis/reddit/models/ModMail.js +24 -24
  27. package/apis/reddit/models/ModNote.d.ts +1 -1
  28. package/apis/reddit/models/ModNote.d.ts.map +1 -1
  29. package/apis/reddit/models/ModNote.js +1 -1
  30. package/apis/reddit/models/Post.d.ts +32 -5
  31. package/apis/reddit/models/Post.d.ts.map +1 -1
  32. package/apis/reddit/models/Post.js +74 -7
  33. package/apis/reddit/models/PrivateMessage.d.ts +1 -1
  34. package/apis/reddit/models/PrivateMessage.d.ts.map +1 -1
  35. package/apis/reddit/models/PrivateMessage.js +1 -1
  36. package/apis/reddit/models/Subreddit.d.ts +27 -9
  37. package/apis/reddit/models/Subreddit.d.ts.map +1 -1
  38. package/apis/reddit/models/Subreddit.js +12 -18
  39. package/apis/reddit/models/User.d.ts +23 -2
  40. package/apis/reddit/models/User.d.ts.map +1 -1
  41. package/apis/reddit/models/User.js +2 -15
  42. package/apis/reddit/models/Vault.d.ts +4 -1
  43. package/apis/reddit/models/Vault.d.ts.map +1 -1
  44. package/apis/reddit/models/Vault.js +3 -8
  45. package/apis/reddit/models/index.d.ts +1 -1
  46. package/apis/reddit/models/index.d.ts.map +1 -1
  47. package/apis/reddit/models/index.js +1 -0
  48. package/apis/reddit/tests/utils/createTestRedditApiClient.d.ts +8 -0
  49. package/apis/reddit/tests/utils/createTestRedditApiClient.d.ts.map +1 -0
  50. package/apis/reddit/tests/utils/createTestRedditApiClient.js +16 -0
  51. package/apis/redis/RedisClient.d.ts +0 -1
  52. package/apis/redis/RedisClient.d.ts.map +1 -1
  53. package/apis/redis/RedisClient.js +6 -0
  54. package/apis/redis/RedisClient.tests.js +3 -0
  55. package/apis/scheduler/SchedulerClient.js +1 -1
  56. package/apis/ui/UIClient.d.ts +3 -1
  57. package/apis/ui/UIClient.d.ts.map +1 -1
  58. package/apis/ui/UIClient.js +13 -12
  59. package/devvit/Devvit.d.ts +2 -2
  60. package/devvit/Devvit.d.ts.map +1 -1
  61. package/devvit/Devvit.js +65 -18
  62. package/devvit/internals/app-settings.d.ts.map +1 -1
  63. package/devvit/internals/app-settings.js +1 -4
  64. package/devvit/internals/blocks/BlocksReconciler.d.ts +105 -0
  65. package/devvit/internals/blocks/BlocksReconciler.d.ts.map +1 -1
  66. package/devvit/internals/blocks/BlocksReconciler.js +15 -13
  67. package/devvit/internals/blocks/handler/BlocksHandler.d.ts.map +1 -1
  68. package/devvit/internals/blocks/handler/BlocksHandler.js +2 -1
  69. package/devvit/internals/blocks/handler/ContextBuilder.d.ts.map +1 -1
  70. package/devvit/internals/blocks/handler/ContextBuilder.js +3 -0
  71. package/devvit/internals/blocks/handler/UIClient.d.ts +7 -5
  72. package/devvit/internals/blocks/handler/UIClient.d.ts.map +1 -1
  73. package/devvit/internals/blocks/handler/UIClient.js +14 -13
  74. package/devvit/internals/blocks/handler/cache.d.ts +1 -1
  75. package/devvit/internals/blocks/handler/cache.d.ts.map +1 -1
  76. package/devvit/internals/blocks/handler/test-helpers.d.ts +1 -1
  77. package/devvit/internals/blocks/handler/test-helpers.d.ts.map +1 -1
  78. package/devvit/internals/blocks/handler/types.d.ts +1 -1
  79. package/devvit/internals/blocks/handler/types.d.ts.map +1 -1
  80. package/devvit/internals/blocks/handler/useAsync.d.ts +1 -1
  81. package/devvit/internals/blocks/handler/useAsync.d.ts.map +1 -1
  82. package/devvit/internals/blocks/handler/useChannel.d.ts +1 -1
  83. package/devvit/internals/blocks/handler/useChannel.d.ts.map +1 -1
  84. package/devvit/internals/blocks/handler/useForm.d.ts +1 -1
  85. package/devvit/internals/blocks/handler/useForm.d.ts.map +1 -1
  86. package/devvit/internals/blocks/handler/useState.d.ts +1 -1
  87. package/devvit/internals/blocks/handler/useState.d.ts.map +1 -1
  88. package/devvit/internals/blocks/handler/useWebView.d.ts +1 -1
  89. package/devvit/internals/blocks/handler/useWebView.d.ts.map +1 -1
  90. package/devvit/internals/blocks/handler/useWebView.js +23 -4
  91. package/devvit/internals/blocks/useChannel.d.ts.map +1 -1
  92. package/devvit/internals/cache.d.ts +1 -1
  93. package/devvit/internals/cache.d.ts.map +1 -1
  94. package/devvit/internals/context.d.ts +1 -1
  95. package/devvit/internals/context.d.ts.map +1 -1
  96. package/devvit/internals/context.js +10 -1
  97. package/devvit/internals/csrf.d.ts.map +1 -1
  98. package/devvit/internals/csrf.js +4 -5
  99. package/devvit/internals/helpers/color.d.ts +1 -1
  100. package/devvit/internals/helpers/color.d.ts.map +1 -1
  101. package/devvit/internals/helpers/devvitInternalMessage.d.ts.map +1 -1
  102. package/devvit/internals/helpers/devvitInternalMessage.js +1 -1
  103. package/devvit/internals/helpers/extendDevvitPrototype.d.ts +1 -6
  104. package/devvit/internals/helpers/extendDevvitPrototype.d.ts.map +1 -1
  105. package/devvit/internals/helpers/extendDevvitPrototype.js +1 -9
  106. package/devvit/internals/installation-settings.d.ts.map +1 -1
  107. package/devvit/internals/installation-settings.js +1 -4
  108. package/devvit/internals/menu-items.d.ts +1 -0
  109. package/devvit/internals/menu-items.d.ts.map +1 -1
  110. package/devvit/internals/menu-items.js +9 -3
  111. package/devvit/internals/semanticColors.d.ts +4 -0
  112. package/devvit/internals/semanticColors.d.ts.map +1 -1
  113. package/devvit/internals/semanticColors.js +4 -0
  114. package/devvit/internals/ui-event-handler.js +3 -3
  115. package/devvit/internals/upgrade-app-shim.d.ts +1 -5
  116. package/devvit/internals/upgrade-app-shim.d.ts.map +1 -1
  117. package/devvit/internals/upgrade-app-shim.js +0 -8
  118. package/index.d.ts +2 -2
  119. package/index.d.ts.map +1 -1
  120. package/index.js +1 -2
  121. package/meta.min.json +401 -342
  122. package/package.json +23 -20
  123. package/public-api.min.js +6 -6
  124. package/public-api.min.js.map +4 -4
  125. package/types/configuration.d.ts +12 -3
  126. package/types/configuration.d.ts.map +1 -1
  127. package/types/context.d.ts +10 -2
  128. package/types/context.d.ts.map +1 -1
  129. package/types/data.d.ts +1 -1
  130. package/types/data.d.ts.map +1 -1
  131. package/types/form.d.ts +6 -89
  132. package/types/form.d.ts.map +1 -1
  133. package/types/form.js +2 -5
  134. package/types/hooks.d.ts +1 -1
  135. package/types/hooks.d.ts.map +1 -1
  136. package/types/icons.d.ts +1 -1
  137. package/types/icons.d.ts.map +1 -1
  138. package/types/icons.js +1 -1
  139. package/types/json.d.ts +43 -0
  140. package/types/json.d.ts.map +1 -0
  141. package/types/json.js +1 -0
  142. package/types/kvStore.d.ts +1 -1
  143. package/types/kvStore.d.ts.map +1 -1
  144. package/types/media.d.ts +1 -1
  145. package/types/menu-item.d.ts +3 -14
  146. package/types/menu-item.d.ts.map +1 -1
  147. package/types/realtime.d.ts +1 -1
  148. package/types/realtime.d.ts.map +1 -1
  149. package/types/redis.d.ts +0 -1
  150. package/types/redis.d.ts.map +1 -1
  151. package/types/scheduler.d.ts +2 -2
  152. package/types/scheduler.d.ts.map +1 -1
  153. package/types/tid.d.ts +47 -0
  154. package/types/tid.d.ts.map +1 -0
  155. package/types/tid.js +114 -0
  156. package/types/ui-client.d.ts +12 -6
  157. package/types/ui-client.d.ts.map +1 -1
  158. package/types/web-view-ui-client.d.ts +1 -1
  159. package/types/web-view-ui-client.d.ts.map +1 -1
  160. package/version.json +6 -8
  161. package/apis/reddit/index.d.ts +0 -1104
  162. package/apis/reddit/index.d.ts.map +0 -1
  163. package/apis/reddit/index.js +0 -1442
  164. package/apis/reddit/tests/utils/createTestRedditApiContext.d.ts +0 -7
  165. package/apis/reddit/tests/utils/createTestRedditApiContext.d.ts.map +0 -1
  166. package/apis/reddit/tests/utils/createTestRedditApiContext.js +0 -23
  167. package/devvit/internals/async-metadata.d.ts +0 -2
  168. package/devvit/internals/async-metadata.d.ts.map +0 -1
  169. package/devvit/internals/async-metadata.js +0 -65
  170. package/meta.json +0 -10428
  171. package/public-api.d.ts +0 -60472
  172. package/public-api.iife.js +0 -102332
  173. package/tsdoc-metadata.json +0 -11
@@ -1,1104 +0,0 @@
1
- import { type FlairCsvResult, type JsonStatus } from '@devvit/protos';
2
- import type { BaseContext } from '../../types/index.js';
3
- import { type AddRemovalNoteOptions, type AddWidgetData, type BanUserOptions, type BanWikiContributorOptions, type CommentSubmissionOptions, type CreateFlairTemplateOptions, type CreateModNoteOptions, type CreateWikiPageOptions, type CrosspostOptions, type DeleteNotesOptions, type EditFlairTemplateOptions, type GetCommentsByUserOptions, type GetCommentsOptions, type GetHotPostsOptions, type GetModerationLogOptions, type GetModNotesOptions, type GetPageRevisionsOptions, type GetPostsByUserOptions, type GetPostsOptions, type GetPostsOptionsWithTimeframe, type GetPrivateMessagesOptions, type GetSubredditUsersByTypeOptions, type GetUserOverviewOptions, type Listing, type ModAction, type ModeratorPermission, type ModLogOptions, type RemovalReason, type SendPrivateMessageAsSubredditOptions, type SendPrivateMessageOptions, type SetPostFlairOptions, type SetUserFlairBatchConfig, type SetUserFlairOptions, type SubmitPostOptions, type SubredditInfo, type SubredditLeaderboard, type SubredditStyles, type UpdatePageSettingsOptions, type UpdateWikiPageOptions, type Vault, type WikiPageRevision, type WikiPageSettings } from './models/index.js';
4
- import { Comment, FlairTemplate, ModMailService, ModNote, Post, PrivateMessage, Subreddit, User, Widget, WikiPage } from './models/index.js';
5
- export type RedditContext = Pick<BaseContext, 'metadata'>;
6
- type GetSubredditUsersOptions = Omit<GetSubredditUsersByTypeOptions, 'type'>;
7
- export type InviteModeratorOptions = {
8
- /** The name of the subreddit to invite the user to moderate */
9
- subredditName: string;
10
- /** The name of the user to invite as a moderator */
11
- username: string;
12
- /** The permissions to grant the user */
13
- permissions?: ModeratorPermission[];
14
- };
15
- export type MuteUserOptions = {
16
- /** The name of the subreddit to mute the user in */
17
- subredditName: string;
18
- /** The name of the user to mute */
19
- username: string;
20
- /** A mod note on why the user was muted. (optional) */
21
- note?: string;
22
- };
23
- /**
24
- * Get ModMail API object
25
- *
26
- * @example
27
- * ```ts
28
- * await modMail.reply({
29
- * body: "Here is my message",
30
- * conversationId: "abcd42";
31
- * })
32
- * ```
33
- */
34
- export declare function modMail(): ModMailService;
35
- /**
36
- * Gets a {@link Subreddit} object by ID
37
- *
38
- * @deprecated Use {@link getSubredditInfoById} instead.
39
- * @param {string} id - The ID (starting with t5_) of the subreddit to retrieve. e.g. t5_2qjpg
40
- * @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
41
- * @example
42
- * ```ts
43
- * const memes = await getSubredditById('t5_2qjpg');
44
- * ```
45
- */
46
- export declare function getSubredditById(id: string): Promise<Subreddit | undefined>;
47
- /**
48
- * Gets a {@link SubredditInfo} object by ID
49
- *
50
- * @param {string} id - The ID (starting with t5_) of the subreddit to retrieve. e.g. t5_2qjpg
51
- * @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
52
- * @example
53
- * ```ts
54
- * const memes = await getSubredditInfoById('t5_2qjpg');
55
- * ```
56
- */
57
- export declare function getSubredditInfoById(id: string): Promise<SubredditInfo>;
58
- /**
59
- * Gets a {@link Subreddit} object by name
60
- *
61
- * @deprecated Use {@link getSubredditInfoByName} instead.
62
- * @param {string} name The name of a subreddit omitting the r/. This is case-insensitive.
63
- * @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
64
- * @example
65
- * ```ts
66
- * const askReddit = await getSubredditByName('askReddit');
67
- * ```
68
- */
69
- export declare function getSubredditByName(name: string): Promise<Subreddit>;
70
- /**
71
- * Gets a {@link SubredditInfo} object by name
72
- *
73
- * @param {string} name The name of a subreddit omitting the r/. This is case-insensitive.
74
- * @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
75
- * @example
76
- * ```ts
77
- * const askReddit = await getSubredditInfoByName('askReddit');
78
- * ```
79
- */
80
- export declare function getSubredditInfoByName(name: string): Promise<SubredditInfo>;
81
- /**
82
- * Add a removal reason to a subreddit
83
- *
84
- * @param subredditName Name of the subreddit being removed.
85
- * @param options Options.
86
- * @param options.title The title of the removal reason.
87
- * @param options.message The message associated with the removal reason.
88
- * @example
89
- * ```ts
90
- * const newReason = await addSubredditRemovalReasons(
91
- * 'askReddit',
92
- * {
93
- * title: 'Spam',
94
- * message: 'This is spam!'
95
- * }
96
- * );
97
- * console.log(newReason.id)
98
- * ```
99
- *
100
- * @returns {string} Removal Reason ID
101
- */
102
- export declare function addSubredditRemovalReason(subredditName: string, options: {
103
- title: string;
104
- message: string;
105
- }): Promise<string>;
106
- /**
107
- * Get the list of subreddit's removal reasons (ordered)
108
- *
109
- * @param subredditName
110
- * @example
111
- * ```ts
112
- * const reasons = await getSubredditRemovalReasons('askReddit');
113
- *
114
- * for (let reason of reasons) {
115
- * console.log(reason.id, reason.message, reason.title)
116
- * }
117
- * ```
118
- *
119
- * @returns Ordered array of Removal Reasons
120
- */
121
- export declare function getSubredditRemovalReasons(subredditName: string): Promise<RemovalReason[]>;
122
- /**
123
- * Retrieves the name of the current subreddit.
124
- *
125
- * @returns {Promise<string>} A Promise that resolves a string representing the current subreddit's name.
126
- * @example
127
- * ```ts
128
- * const currentSubredditName = await getCurrentSubredditName();
129
- * ```
130
- */
131
- export declare function getCurrentSubredditName(): Promise<string>;
132
- /**
133
- * Retrieves the current subreddit.
134
- *
135
- * @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
136
- * @example
137
- * ```ts
138
- * const currentSubreddit = await getCurrentSubreddit();
139
- * ```
140
- */
141
- export declare function getCurrentSubreddit(): Promise<Subreddit>;
142
- /**
143
- * Gets a {@link Post} object by ID
144
- *
145
- * @param id
146
- * @returns A Promise that resolves to a Post object.
147
- */
148
- export declare function getPostById(id: string): Promise<Post>;
149
- /**
150
- * Submits a new post to a subreddit.
151
- *
152
- * @param options - Either a self post or a link post.
153
- * @returns A Promise that resolves to a Post object.
154
- * @example
155
- * ```ts
156
- * const post = await submitPost({
157
- * subredditName: 'devvit',
158
- * title: 'Hello World',
159
- * richtext: new RichTextBuilder()
160
- * .heading({ level: 1 }, (h) => {
161
- * h.rawText('Hello world');
162
- * })
163
- * .codeBlock({}, (cb) => cb.rawText('This post was created via the Devvit API'))
164
- * .build()
165
- * });
166
- * ```
167
- */
168
- export declare function submitPost(options: SubmitPostOptions): Promise<Post>;
169
- /**
170
- * Crossposts a post to a subreddit.
171
- *
172
- * @param options - Options for crossposting a post
173
- * @param options.subredditName - The name of the subreddit to crosspost to
174
- * @param options.postId - The ID of the post to crosspost
175
- * @param options.title - The title of the crosspost
176
- * @returns - A Promise that resolves to a Post object.
177
- */
178
- export declare function crosspost(options: CrosspostOptions): Promise<Post>;
179
- /**
180
- * Gets a {@link User} object by ID
181
- *
182
- * @param id - The ID (starting with t2_) of the user to retrieve. e.g. t2_1qjpg
183
- * @returns A Promise that resolves to a User object.
184
- * @example
185
- * ```ts
186
- * const user = await getUserById('t2_1qjpg');
187
- * ```
188
- */
189
- export declare function getUserById(id: string): Promise<User | undefined>;
190
- /**
191
- * Gets a {@link User} object by username
192
- *
193
- * @param username - The username of the user omitting the u/. e.g. 'devvit'
194
- * @returns A Promise that resolves to a User object or undefined if user is
195
- * not found (user doesn't exist, account suspended, etc).
196
- * @example
197
- * ```ts
198
- * const user = await getUserByUsername('devvit');
199
- * if (user) {
200
- * console.log(user)
201
- * }
202
- * ```
203
- */
204
- export declare function getUserByUsername(username: string): Promise<User | undefined>;
205
- /**
206
- * Get the current calling user's username.
207
- * Resolves to undefined for logged-out custom post renders.
208
- *
209
- * @returns A Promise that resolves to a string representing the username or undefined
210
- * @example
211
- * ```ts
212
- * const username = await getCurrentUsername();
213
- * ```
214
- */
215
- export declare function getCurrentUsername(): Promise<string | undefined>;
216
- /**
217
- * Get the current calling user.
218
- * Resolves to undefined for logged-out custom post renders.
219
- *
220
- * @returns A Promise that resolves to a User object or undefined
221
- * @example
222
- * ```ts
223
- * const user = await getCurrentUser();
224
- * ```
225
- */
226
- export declare function getCurrentUser(): Promise<User | undefined>;
227
- /**
228
- * Get the user that the app runs as on the provided metadata.
229
- *
230
- * @returns A Promise that resolves to a User object.
231
- * @example
232
- * ```ts
233
- * const user = await getAppUser(metadata);
234
- * ```
235
- */
236
- export declare function getAppUser(): Promise<User>;
237
- /**
238
- * Get the snoovatar URL for a given username.
239
- *
240
- * @param username - The username of the snoovatar to retrieve
241
- * @returns A Promise that resolves to a URL of the snoovatar image if it exists.
242
- */
243
- export declare function getSnoovatarUrl(username: string): Promise<string | undefined>;
244
- /**
245
- * Get a {@link Comment} object by ID
246
- *
247
- * @param id - The ID (starting with t1_) of the comment to retrieve. e.g. t1_1qjpg
248
- * @returns A Promise that resolves to a Comment object.
249
- * @example
250
- * ```ts
251
- * const comment = await getCommentById('t1_1qjpg');
252
- * ```
253
- */
254
- export declare function getCommentById(id: string): Promise<Comment>;
255
- /**
256
- * Get a list of comments from a specific post or comment.
257
- *
258
- * @param options - Options for the request
259
- * @param options.postId - The ID of the post e.g. 't3_1qjpg'
260
- * @param options.commentId - The ID of the comment e.g. 't1_1qjpg'
261
- * @param options.limit - The maximum number of comments to return. e.g. 1000
262
- * @param options.pageSize - The number of comments to return per request. e.g. 100
263
- * @param options.sort - The sort order of the comments. e.g. 'new'
264
- * @returns A Listing of Comment objects.
265
- * @example
266
- * ```ts
267
- * const comments = await getComments({
268
- * postId: 't3_1qjpg',
269
- * limit: 1000,
270
- * pageSize: 100
271
- * }).all();
272
- * ```
273
- */
274
- export declare function getComments(options: GetCommentsOptions): Listing<Comment>;
275
- /**
276
- * Get a list of comments by a specific user.
277
- *
278
- * @param options - Options for the request
279
- * @param options.username - The username of the user omitting the u/. e.g. 'spez'
280
- * @param options.sort - The sort order of the comments. e.g. 'new'
281
- * @param options.timeframe - The timeframe of the comments. e.g. 'all'
282
- * @param options.limit - The maximum number of comments to return. e.g. 1000
283
- * @param options.pageSize - The number of comments to return per request. e.g. 100
284
- * @returns A Listing of Comment objects.
285
- */
286
- export declare function getCommentsByUser(options: GetCommentsByUserOptions): Listing<Comment>;
287
- /**
288
- * Submit a new comment to a post or comment.
289
- *
290
- * @param options - You must provide either `options.text` or `options.richtext` but not both.
291
- * @param options.id - The ID of the post or comment to comment on. e.g. 't3_1qjpg' for post and 't1_1qgif' for comment
292
- * @param options.text - The text of the comment
293
- * @param options.richtext - The rich text of the comment
294
- * @returns A Promise that resolves to a Comment object.
295
- */
296
- export declare function submitComment(options: CommentSubmissionOptions & {
297
- id: string;
298
- }): Promise<Comment>;
299
- /**
300
- * Get a list of controversial posts from a specific subreddit.
301
- *
302
- * @param options - Options for the request
303
- * @param options.subredditName - The name of the subreddit to get posts from. e.g. 'memes'
304
- * @param options.timeframe - The timeframe to get posts from. e.g. 'day'
305
- * @param options.limit - The maximum number of posts to return. e.g. 1000
306
- * @param options.pageSize - The number of posts to return per request. e.g. 100
307
- * @returns A Listing of Post objects.
308
- * @example
309
- * ```ts
310
- * const posts = await getControversialPosts({
311
- * subredditName: 'memes',
312
- * timeframe: 'day',
313
- * limit: 1000,
314
- * pageSize: 100
315
- * }).all();
316
- * ```
317
- */
318
- export declare function getControversialPosts(options: GetPostsOptionsWithTimeframe): Listing<Post>;
319
- /**
320
- * Get a list of controversial posts from a specific subreddit.
321
- *
322
- * @param options - Options for the request
323
- * @param options.subredditName - The name of the subreddit to get posts from. e.g. 'memes'
324
- * @param options.timeframe - The timeframe to get posts from. e.g. 'day'
325
- * @param options.limit - The maximum number of posts to return. e.g. 1000
326
- * @param options.pageSize - The number of posts to return per request. e.g. 100
327
- * @returns A Listing of Post objects.
328
- * @example
329
- * ```ts
330
- * const posts = await getControversialPosts({
331
- * subredditName: 'memes',
332
- * timeframe: 'day',
333
- * limit: 1000,
334
- * pageSize: 100
335
- * }).all();
336
- * ```
337
- */
338
- export declare function getTopPosts(options: GetPostsOptionsWithTimeframe): Listing<Post>;
339
- /**
340
- * Get a list of hot posts from a specific subreddit.
341
- *
342
- * @param options - Options for the request
343
- * @param options.subredditName - The name of the subreddit to get posts from. e.g. 'memes'
344
- * @param options.timeframe - The timeframe to get posts from. e.g. 'day'
345
- * @param options.limit - The maximum number of posts to return. e.g. 1000
346
- * @param options.pageSize - The number of posts to return per request. e.g. 100
347
- * @returns A Listing of Post objects.
348
- * @example
349
- * ```ts
350
- * const posts = await getHotPosts({
351
- * subredditName: 'memes',
352
- * timeframe: 'day',
353
- * limit: 1000,
354
- * pageSize: 100
355
- * }).all();
356
- * ```
357
- */
358
- export declare function getHotPosts(options: GetHotPostsOptions): Listing<Post>;
359
- /**
360
- * Get a list of new posts from a specific subreddit.
361
- *
362
- * @param options - Options for the request
363
- * @param options.subredditName - The name of the subreddit to get posts from. e.g. 'memes'
364
- * @param options.limit - The maximum number of posts to return. e.g. 1000
365
- * @param options.pageSize - The number of posts to return per request. e.g. 100
366
- * @returns A Listing of Post objects.
367
- * @example
368
- * ```ts
369
- * const posts = await getNewPosts({
370
- * subredditName: 'memes',
371
- * limit: 1000,
372
- * pageSize: 100
373
- * }).all();
374
- * ```
375
- */
376
- export declare function getNewPosts(options: GetPostsOptions): Listing<Post>;
377
- /**
378
- * Get a list of hot posts from a specific subreddit.
379
- *
380
- * @param options - Options for the request
381
- * @param options.subredditName - The name of the subreddit to get posts from. e.g. 'memes'
382
- * @param options.timeframe - The timeframe to get posts from. e.g. 'day'
383
- * @param options.limit - The maximum number of posts to return. e.g. 1000
384
- * @param options.pageSize - The number of posts to return per request. e.g. 100
385
- * @returns A Listing of Post objects.
386
- * @example
387
- * ```ts
388
- * const posts = await getRisingPosts({
389
- * subredditName: 'memes',
390
- * timeframe: 'day',
391
- * limit: 1000,
392
- * pageSize: 100
393
- * }).all();
394
- * ```
395
- */
396
- export declare function getRisingPosts(options: GetPostsOptions): Listing<Post>;
397
- /**
398
- * Get a list of posts from a specific user.
399
- *
400
- * @param options - Options for the request
401
- * @param options.username - The username of the user omitting the u/. e.g. 'spez'
402
- * @param options.sort - The sort method to use. e.g. 'new'
403
- * @param options.timeframe - The timeframe to get posts from. e.g. 'day'
404
- * @param options.limit - The maximum number of posts to return. e.g. 1000
405
- * @param options.pageSize - The number of posts to return per request. e.g. 100
406
- * @returns A Listing of Post objects.
407
- */
408
- export declare function getPostsByUser(options: GetPostsByUserOptions): Listing<Post>;
409
- /**
410
- * Get a list of posts and comments from a specific user.
411
- *
412
- * @param options - Options for the request
413
- * @param options.username - The username of the user omitting the u/. e.g. 'spez'
414
- * @param options.sort - The sort method to use. e.g. 'new'
415
- * @param options.timeframe - The timeframe to get posts from. e.g. 'day'
416
- * @param options.limit - The maximum number of posts to return. e.g. 1000
417
- * @param options.pageSize - The number of posts to return per request. e.g. 100
418
- * @returns A Listing of `Post` and `Comment` objects.
419
- */
420
- export declare function getCommentsAndPostsByUser(options: GetUserOverviewOptions): Listing<Post | Comment>;
421
- /**
422
- * Get the moderation log for a subreddit.
423
- *
424
- * @param options - Options for the request
425
- * @param options.subredditName - The name of the subreddit to get the moderation log from. e.g. 'memes'
426
- * @param options.moderatorUsernames (optional) A moderator filter. Accepts an array of usernames
427
- * @param options.type (optional) Filter the entries by the type of the Moderator action
428
- * @param options.limit - (optional) The maximum number of ModActions to return. e.g. 1000
429
- * @param options.pageSize - (optional) The number of ModActions to return per request. e.g. 100
430
- * @returns A Listing of ModAction objects.
431
- * @example
432
- * ```ts
433
- * const modActions = await getModerationLog({
434
- * subredditName: 'memes',
435
- * moderatorUsernames: ['spez'],
436
- * type: 'banuser',
437
- * limit: 1000,
438
- * pageSize: 100
439
- * }).all();
440
- * ```
441
- */
442
- export declare function getModerationLog(options: GetModerationLogOptions): Listing<ModAction>;
443
- /**
444
- * Get a list of users who have been approved to post in a subreddit.
445
- *
446
- * @param options - Options for the request
447
- * @param options.subredditName - The name of the subreddit to get the approved users from. e.g. 'memes'
448
- * @param options.username - Use this to see if a user is approved to post in the subreddit.
449
- * @param options.limit - The maximum number of users to return. e.g. 1000
450
- * @param options.pageSize - The number of users to return per request. e.g. 100
451
- * @returns A Listing of User objects.
452
- */
453
- export declare function getApprovedUsers(options: GetSubredditUsersOptions): Listing<User>;
454
- /**
455
- * Approve a user to post in a subreddit.
456
- *
457
- * @param username - The username of the user to approve. e.g. 'spez'
458
- * @param subredditName - The name of the subreddit to approve the user in. e.g. 'memes'
459
- */
460
- export declare function approveUser(username: string, subredditName: string): Promise<void>;
461
- /**
462
- * Remove a user's approval to post in a subreddit.
463
- *
464
- * @param username - The username of the user to remove approval from. e.g. 'spez'
465
- * @param subredditName - The name of the subreddit to remove the user's approval from. e.g. 'memes'
466
- */
467
- export declare function removeUser(username: string, subredditName: string): Promise<void>;
468
- /**
469
- * Get a list of users who are wiki contributors of a subreddit.
470
- *
471
- * @param options - Options for the request
472
- * @param options.subredditName - The name of the subreddit to get the wiki contributors from. e.g. 'memes'
473
- * @param options.username - Use this to see if a user is a wiki contributor for the subreddit.
474
- * @param options.limit - The maximum number of users to return. e.g. 1000
475
- * @param options.pageSize - The number of users to return per request. e.g. 100
476
- * @returns A Listing of User objects.
477
- */
478
- export declare function getWikiContributors(options: GetSubredditUsersOptions): Listing<User>;
479
- /**
480
- * Add a user as a wiki contributor for a subreddit.
481
- *
482
- * @param username - The username of the user to add as a wiki contributor. e.g. 'spez'
483
- * @param subredditName - The name of the subreddit to add the user as a wiki contributor. e.g. 'memes'
484
- */
485
- export declare function addWikiContributor(username: string, subredditName: string): Promise<void>;
486
- /**
487
- * Remove a user's wiki contributor status for a subreddit.
488
- *
489
- * @param username - The username of the user to remove wiki contributor status from. e.g. 'spez'
490
- * @param subredditName - The name of the subreddit to remove the user's wiki contributor status from. e.g. 'memes'
491
- */
492
- export declare function removeWikiContributor(username: string, subredditName: string): Promise<void>;
493
- /**
494
- * Get a list of users who are banned from a subreddit.
495
- *
496
- * @param options - Options for the request
497
- * @param options.subredditName - The name of the subreddit to get the banned users from. e.g. 'memes'
498
- * @param options.username - Use this to see if a user is banned from the subreddit.
499
- * @param options.limit - The maximum number of users to return. e.g. 1000
500
- * @param options.pageSize - The number of users to return per request. e.g. 100
501
- * @returns A Listing of User objects.
502
- */
503
- export declare function getBannedUsers(options: GetSubredditUsersOptions): Listing<User>;
504
- /**
505
- * Ban a user from a subreddit.
506
- *
507
- * @param options - Options for the request
508
- * @param options.username - The username of the user to ban. e.g. 'spez'
509
- * @param options.subredditName - The name of the subreddit to ban the user from. e.g. 'memes'
510
- * @param options.note - A mod note for the ban. (optional)
511
- * @param options.duration - The number of days the user should be banned for. (optional)
512
- * @param options.message - A message to send to the user when they are banned. (optional)
513
- * @param options.context - The ID of the post or comment that caused the ban. (optional)
514
- * @param options.reason - The reason for the ban. (optional)
515
- */
516
- export declare function banUser(options: BanUserOptions): Promise<void>;
517
- /**
518
- * Unban a user from a subreddit.
519
- *
520
- * @param username - The username of the user to unban. e.g. 'spez'
521
- * @param subredditName - The name of the subreddit to unban the user from. e.g. 'memes'
522
- */
523
- export declare function unbanUser(username: string, subredditName: string): Promise<void>;
524
- /**
525
- * Get a list of users who are banned from contributing to the wiki on a subreddit.
526
- *
527
- * @param options - Options for the request
528
- * @param options.subredditName - The name of the subreddit to get the banned wiki contributors from. e.g. 'memes'
529
- * @param options.username - Use this to see if a user is banned from contributing to the wiki on a subreddit.
530
- * @param options.limit - The maximum number of users to return. e.g. 1000
531
- * @param options.pageSize - The number of users to return per request. e.g. 100
532
- * @returns A Listing of User objects.
533
- */
534
- export declare function getBannedWikiContributors(options: GetSubredditUsersOptions): Listing<User>;
535
- /**
536
- * Ban a user from contributing to the wiki on a subreddit.
537
- *
538
- * @param options - Options for the request
539
- * @param options.username - The username of the user to ban. e.g. 'spez'
540
- * @param options.subredditName - The name of the subreddit to ban the user from contributing to the wiki on. e.g. 'memes'
541
- * @param options.reason - The reason for the ban. (optional)
542
- * @param options.duration - The number of days the user should be banned for. (optional)
543
- * @param options.note - A mod note for the ban. (optional)
544
- */
545
- export declare function banWikiContributor(options: BanWikiContributorOptions): Promise<void>;
546
- /**
547
- *
548
- * @param username - The username of the user to unban. e.g. 'spez'
549
- * @param subredditName - The name of the subreddit to unban the user from contributing to the wiki on. e.g. 'memes'
550
- */
551
- export declare function unbanWikiContributor(username: string, subredditName: string): Promise<void>;
552
- /**
553
- * Get a list of users who are moderators for a subreddit.
554
- *
555
- * @param options - Options for the request
556
- * @param options.subredditName - The name of the subreddit to get the moderators from. e.g. 'memes'
557
- * @param options.username - Use this to see if a user is a moderator of the subreddit.
558
- * @param options.limit - The maximum number of users to return. e.g. 1000
559
- * @param options.pageSize - The number of users to return per request. e.g. 100
560
- * @returns A Listing of User objects.
561
- */
562
- export declare function getModerators(options: GetSubredditUsersOptions): Listing<User>;
563
- /**
564
- * Invite a user to become a moderator of a subreddit.
565
- *
566
- * @param options - Options for the request
567
- * @param options.username - The username of the user to invite. e.g. 'spez'
568
- * @param options.subredditName - The name of the subreddit to invite the user to moderate. e.g. 'memes'
569
- * @param options.permissions - The permissions to give the user. (optional) Defaults to 'all'.
570
- */
571
- export declare function inviteModerator(options: InviteModeratorOptions): Promise<void>;
572
- /**
573
- * Revoke a moderator invite for a user to a subreddit.
574
- *
575
- * @param username - The username of the user to revoke the invite for. e.g. 'spez'
576
- * @param subredditName - The name of the subreddit to revoke the invite for. e.g. 'memes'
577
- */
578
- export declare function revokeModeratorInvite(username: string, subredditName: string): Promise<void>;
579
- /**
580
- * Remove a user as a moderator of a subreddit.
581
- *
582
- * @param username - The username of the user to remove as a moderator. e.g. 'spez'
583
- * @param subredditName - The name of the subreddit to remove the user as a moderator from. e.g. 'memes'
584
- */
585
- export declare function removeModerator(username: string, subredditName: string): Promise<void>;
586
- /**
587
- * Update the permissions of a moderator of a subreddit.
588
- *
589
- * @param username - The username of the user to update the permissions for. e.g. 'spez'
590
- * @param subredditName - The name of the subreddit. e.g. 'memes'
591
- * @param permissions - The permissions to give the user. e.g ['posts', 'wiki']
592
- */
593
- export declare function setModeratorPermissions(username: string, subredditName: string, permissions: ModeratorPermission[]): Promise<void>;
594
- /**
595
- * Get a list of users who are muted in a subreddit.
596
- *
597
- * @param options - Options for the request
598
- * @param options.subredditName - The name of the subreddit to get the muted users from. e.g. 'memes'
599
- * @param options.username - Use this to see if a user is muted in the subreddit.
600
- * @param options.limit - The maximum number of users to return. e.g. 1000
601
- * @param options.pageSize - The number of users to return per request. e.g. 100
602
- * @returns A listing of User objects.
603
- */
604
- export declare function getMutedUsers(options: GetSubredditUsersOptions): Listing<User>;
605
- /**
606
- * Mute a user in a subreddit. Muting a user prevents them from sending modmail.
607
- *
608
- * @param options - Options for the request
609
- * @param options.username - The username of the user to mute. e.g. 'spez'
610
- * @param options.subredditName - The name of the subreddit to mute the user in. e.g. 'memes'
611
- * @param options.note - A mod note on why the user was muted. (optional)
612
- */
613
- export declare function muteUser(options: MuteUserOptions): Promise<void>;
614
- /**
615
- * Unmute a user in a subreddit. Unmuting a user allows them to send modmail.
616
- *
617
- * @param username - The username of the user to unmute. e.g. 'spez'
618
- * @param subredditName - The name of the subreddit to unmute the user in. e.g. 'memes'
619
- */
620
- export declare function unmuteUser(username: string, subredditName: string): Promise<void>;
621
- /**
622
- * Get a list of mod notes related to a user in a subreddit.
623
- *
624
- * @param options - Options for the request
625
- * @param options.subredditName - The name of the subreddit to get the mod notes from. e.g. 'memes'
626
- * @param options.username - The username of the user to get the mod notes for. e.g. 'spez'
627
- * @param options.filter - Filter the mod notes by type. e.g. 'NOTE', 'BAN', 'APPROVAL'
628
- * @param options.limit - The maximum number of mod notes to return. e.g. 1000
629
- * @param options.pageSize - The number of mod notes to return per request. e.g. 100
630
- * @returns A listing of ModNote objects.
631
- */
632
- export declare function getModNotes(options: GetModNotesOptions): Listing<ModNote>;
633
- /**
634
- * Delete a mod note.
635
- *
636
- * @param options - Options for the request
637
- * @param options.subreddit - The name of the subreddit to delete the mod note from. e.g. 'memes'
638
- * @param options.noteId - The ID of the mod note to delete (should have a ModNote_ prefix).
639
- * @returns True if it was deleted successfully; false otherwise.
640
- */
641
- export declare function deleteModNote(options: DeleteNotesOptions): Promise<boolean>;
642
- /**
643
- * Add a mod note.
644
- *
645
- * @param options - Options for the request
646
- * @param options.subreddit - The name of the subreddit to add the mod note to. e.g. 'memes'
647
- * @param options.user - The username of the user to add the mod note to. e.g. 'spez'
648
- * @param options.redditId - (optional) The ID of the comment or post to add the mod note to. e.g. 't3_1234'
649
- * @param options.label - (optional) The label of the mod note. e.g. 'SPAM_WARNING'
650
- * @param options.note - The text of the mod note.
651
- * @returns A Promise that resolves if the mod note was successfully added.
652
- */
653
- export declare function addModNote(options: CreateModNoteOptions): Promise<ModNote>;
654
- /**
655
- * Add a mod note for why a post or comment was removed
656
- *
657
- * @param options - The options for adding a removal note.
658
- * @param options.itemIds list of thing ids
659
- * @param options.reasonId id of a Removal Reason - you can leave this as an empty string if you don't have one
660
- * @param options.modNote the reason for removal (maximum 100 characters) (optional)
661
- */
662
- export declare function addRemovalNote(options: AddRemovalNoteOptions): Promise<void>;
663
- /**
664
- * Sends a private message to a user.
665
- *
666
- * @param options - The options for sending the message.
667
- * @returns A Promise that resolves if the private message was successfully sent.
668
- */
669
- export declare function sendPrivateMessage(options: SendPrivateMessageOptions): Promise<void>;
670
- /**
671
- * Sends a private message to a user on behalf of a subreddit.
672
- *
673
- * @param options - The options for sending the message as a subreddit.
674
- * @returns A Promise that resolves if the private message was successfully sent.
675
- */
676
- export declare function sendPrivateMessageAsSubreddit(options: SendPrivateMessageAsSubredditOptions): Promise<void>;
677
- /**
678
- * Approve a post or comment.
679
- *
680
- * @param id - The id of the post (t3_) or comment (t1_) to approve.
681
- * @example
682
- * ```ts
683
- * await approve('t3_123456');
684
- * await approve('t1_123456');
685
- * ```
686
- */
687
- export declare function approve(id: string): Promise<void>;
688
- /**
689
- * Remove a post or comment.
690
- *
691
- * @param id - The id of the post (t3_) or comment (t1_) to remove.
692
- * @param isSpam - Is the post or comment being removed because it's spam?
693
- * @example
694
- * ```ts
695
- * await remove('t3_123456', false);
696
- * await remove('t1_123456', true);
697
- * ```
698
- */
699
- export declare function remove(id: string, isSpam: boolean): Promise<void>;
700
- /**
701
- * Get the list of post flair templates for a subreddit.
702
- *
703
- * @param subredditName - The name of the subreddit to get the post flair templates for.
704
- * @returns A Promise that resolves with an array of FlairTemplate objects.
705
- */
706
- export declare function getPostFlairTemplates(subredditName: string): Promise<FlairTemplate[]>;
707
- /**
708
- * Get the list of user flair templates for a subreddit.
709
- *
710
- * @param subredditName - The name of the subreddit to get the user flair templates for.
711
- * @returns A Promise that resolves with an array of FlairTemplate objects.
712
- */
713
- export declare function getUserFlairTemplates(subredditName: string): Promise<FlairTemplate[]>;
714
- /**
715
- * Create a post flair template for a subreddit.
716
- *
717
- * @param options - Options for the request
718
- * @param options.subredditName - The name of the subreddit to create the flair template for.
719
- * @param options.allowableContent - The content that is allowed to be used with this flair template. e.g. 'all' or 'text' or 'emoji'
720
- * @param options.backgroundColor - The background color of the flair template. e.g. '#ff0000' or 'transparent'
721
- * @param options.maxEmojis - The maximum number of emojis that can be used with this flair template.
722
- * @param options.modOnly - Whether or not this flair template is only available to mods.
723
- * @param options.text - The text of the flair template.
724
- * @param options.textColor - The text color of the flair template. Either 'dark' or 'light'.
725
- * @param options.allowUserEdits - Whether or not users can edit the flair template when selecting a flair.
726
- * @returns The created FlairTemplate object.
727
- */
728
- export declare function createPostFlairTemplate(options: CreateFlairTemplateOptions): Promise<FlairTemplate>;
729
- /**
730
- * Create a user flair template for a subreddit.
731
- *
732
- * @param options - Options for the request
733
- * @param options.subredditName - The name of the subreddit to create the flair template for.
734
- * @param options.allowableContent - The content that is allowed to be used with this flair template. e.g. 'all' or 'text' or 'emoji'
735
- * @param options.backgroundColor - The background color of the flair template. e.g. '#ff0000' or 'transparent'
736
- * @param options.maxEmojis - The maximum number of emojis that can be used with this flair template.
737
- * @param options.modOnly - Whether or not this flair template is only available to mods.
738
- * @param options.text - The text of the flair template.
739
- * @param options.textColor - The text color of the flair template. Either 'dark' or 'light'.
740
- * @param options.allowUserEdits - Whether or not users can edit the flair template when selecting a flair.
741
- * @returns The created FlairTemplate object.
742
- */
743
- export declare function createUserFlairTemplate(options: CreateFlairTemplateOptions): Promise<FlairTemplate>;
744
- /**
745
- * Edit a flair template for a subreddit. This can be either a post or user flair template.
746
- * Note: If you leave any of the options fields as undefined, they will reset to their default values.
747
- *
748
- * @param options - Options for the request
749
- * @param options.id - The ID of the flair template to edit.
750
- * @param options.subredditName - The name of the subreddit to create the flair template for.
751
- * @param options.allowableContent - The content that is allowed to be used with this flair template. e.g. 'all' or 'text' or 'emoji'
752
- * @param options.backgroundColor - The background color of the flair template. e.g. '#ff0000' or 'transparent'
753
- * @param options.maxEmojis - The maximum number of emojis that can be used with this flair template.
754
- * @param options.modOnly - Is this flair template only available to mods?
755
- * @param options.text - The text of the flair template.
756
- * @param options.textColor - The text color of the flair template. Either 'dark' or 'light'.
757
- * @param options.allowUserEdits - Can users can edit the flair template when selecting a flair?
758
- * @returns The edited FlairTemplate object.
759
- */
760
- export declare function editFlairTemplate(options: EditFlairTemplateOptions): Promise<FlairTemplate>;
761
- /**
762
- * Delete a flair template from a subreddit.
763
- *
764
- * @param subredditName - The name of the subreddit to delete the flair template from.
765
- * @param flairTemplateId - The ID of the flair template to delete.
766
- */
767
- export declare function deleteFlairTemplate(subredditName: string, flairTemplateId: string): Promise<void>;
768
- /**
769
- * Set the flair for a user in a subreddit.
770
- *
771
- * @param options - Options for the request
772
- * @param options.subredditName - The name of the subreddit to set the flair for.
773
- * @param options.username - The username of the user to set the flair for.
774
- * @param options.flairTemplateId - The ID of the flair template to use.
775
- * @param options.text - The text of the flair.
776
- * @param options.cssClass - The CSS class of the flair.
777
- * @param options.backgroundColor - The background color of the flair.
778
- * @param options.textColor - The text color of the flair.
779
- */
780
- export declare function setUserFlair(options: SetUserFlairOptions): Promise<void>;
781
- /**
782
- * Set the flair of multiple users in the same subreddit with a single API call.
783
- * Can process up to 100 entries at once.
784
- *
785
- * @param subredditName - The name of the subreddit to edit flairs in.
786
- * @param {SetUserFlairBatchConfig[]} flairs - Array of user flair configuration objects. If both text and cssClass are empty for a given user the flair will be cleared.
787
- * @param flairs[].username - The username of the user to edit the flair for.
788
- * @param flairs[].text - The text of the flair.
789
- * @param flairs[].cssClass - The CSS class of the flair.
790
- * @returns {FlairCsvResult[]} - Array of statuses for each entry provided.
791
- */
792
- export declare function setUserFlairBatch(subredditName: string, flairs: SetUserFlairBatchConfig[]): Promise<FlairCsvResult[]>;
793
- /**
794
- * Remove the flair for a user in a subreddit.
795
- *
796
- * @param subredditName - The name of the subreddit to remove the flair from.
797
- * @param username - The username of the user to remove the flair from.
798
- */
799
- export declare function removeUserFlair(subredditName: string, username: string): Promise<void>;
800
- /**
801
- * Set the flair for a post in a subreddit.
802
- *
803
- * @param options - Options for the request
804
- * @param options.subredditName - The name of the subreddit to set the flair for.
805
- * @param options.postId - The ID of the post to set the flair for.
806
- * @param options.flairTemplateId - The ID of the flair template to use.
807
- * @param options.text - The text of the flair.
808
- * @param options.cssClass - The CSS class of the flair.
809
- * @param options.backgroundColor - The background color of the flair.
810
- * @param options.textColor - The text color of the flair.
811
- */
812
- export declare function setPostFlair(options: SetPostFlairOptions): Promise<void>;
813
- /**
814
- * Remove the flair for a post in a subreddit.
815
- *
816
- * @param subredditName - The name of the subreddit to remove the flair from.
817
- * @param postId - The ID of the post to remove the flair from.
818
- */
819
- export declare function removePostFlair(subredditName: string, postId: string): Promise<void>;
820
- /**
821
- * Get the widgets for a subreddit.
822
- *
823
- * @param subredditName - The name of the subreddit to get the widgets for.
824
- * @returns - An array of Widget objects.
825
- */
826
- export declare function getWidgets(subredditName: string): Promise<Widget[]>;
827
- /**
828
- * Delete a widget from a subreddit.
829
- *
830
- * @param subredditName - The name of the subreddit to delete the widget from.
831
- * @param widgetId - The ID of the widget to delete.
832
- */
833
- export declare function deleteWidget(subredditName: string, widgetId: string): Promise<void>;
834
- /**
835
- * Add a widget to a subreddit.
836
- *
837
- * @param widgetData - The data for the widget to add.
838
- * @returns - The added Widget object.
839
- */
840
- export declare function addWidget(widgetData: AddWidgetData): Promise<Widget>;
841
- /**
842
- * Reorder the widgets for a subreddit.
843
- *
844
- * @param subredditName - The name of the subreddit to reorder the widgets for.
845
- * @param orderByIds - An array of widget IDs in the order that they should be displayed.
846
- */
847
- export declare function reorderWidgets(subredditName: string, orderByIds: string[]): Promise<void>;
848
- /**
849
- * Get a wiki page from a subreddit.
850
- *
851
- * @param subredditName - The name of the subreddit to get the wiki page from.
852
- * @param page - The name of the wiki page to get.
853
- * @returns The requested WikiPage object.
854
- */
855
- export declare function getWikiPage(subredditName: string, page: string): Promise<WikiPage>;
856
- /**
857
- * Get the wiki pages for a subreddit.
858
- *
859
- * @param subredditName - The name of the subreddit to get the wiki pages from.
860
- * @returns A list of the wiki page names for the subreddit.
861
- */
862
- export declare function getWikiPages(subredditName: string): Promise<string[]>;
863
- /**
864
- * Create a new wiki page for a subreddit.
865
- *
866
- * @param options - Options for the request
867
- * @param options.subredditName - The name of the subreddit the wiki is in.
868
- * @param options.page - The name of the wiki page to create.
869
- * @param options.content - The Markdown content of the wiki page.
870
- * @param options.reason - The reason for creating the wiki page.
871
- * @returns - The created WikiPage object.
872
- */
873
- export declare function createWikiPage(options: CreateWikiPageOptions): Promise<WikiPage>;
874
- /**
875
- * Update a wiki page.
876
- *
877
- * @param options - Options for the request
878
- * @param options.subredditName - The name of the subreddit the wiki is in.
879
- * @param options.page - The name of the wiki page to update.
880
- * @param options.content - The Markdown content of the wiki page.
881
- * @param options.reason - The reason for updating the wiki page.
882
- * @returns The updated WikiPage object.
883
- */
884
- export declare function updateWikiPage(options: UpdateWikiPageOptions): Promise<WikiPage>;
885
- /**
886
- * Get the revisions for a wiki page.
887
- *
888
- * @param options - Options for the request
889
- * @param options.subredditName - The name of the subreddit the wiki is in.
890
- * @param options.page - The name of the wiki page to get the revisions for.
891
- * @param options.limit - The maximum number of revisions to return.
892
- * @param options.after - The ID of the revision to start after.
893
- * @returns A Listing of WikiPageRevision objects.
894
- */
895
- export declare function getWikiPageRevisions(options: GetPageRevisionsOptions): Listing<WikiPageRevision>;
896
- /**
897
- * Revert a wiki page to a previous revision.
898
- *
899
- * @param subredditName - The name of the subreddit the wiki is in.
900
- * @param page - The name of the wiki page to revert.
901
- * @param revisionId - The ID of the revision to revert to.
902
- */
903
- export declare function revertWikiPage(subredditName: string, page: string, revisionId: string): Promise<void>;
904
- /**
905
- * Get the settings for a wiki page.
906
- *
907
- * @param subredditName - The name of the subreddit the wiki is in.
908
- * @param page - The name of the wiki page to get the settings for.
909
- * @returns A WikiPageSettings object.
910
- */
911
- export declare function getWikiPageSettings(subredditName: string, page: string): Promise<WikiPageSettings>;
912
- /**
913
- * Update the settings for a wiki page.
914
- *
915
- * @param options - Options for the request
916
- * @param options.subredditName - The name of the subreddit the wiki is in.
917
- * @param options.page - The name of the wiki page to update the settings for.
918
- * @param options.listed - Whether the wiki page should be listed in the wiki index.
919
- * @param options.permLevel - The permission level required to edit the wiki page.
920
- * @returns A WikiPageSettings object.
921
- */
922
- export declare function updateWikiPageSettings(options: UpdatePageSettingsOptions): Promise<WikiPageSettings>;
923
- /**
924
- * Add an editor to a wiki page.
925
- *
926
- * @param subredditName - The name of the subreddit the wiki is in.
927
- * @param page - The name of the wiki page to add the editor to.
928
- * @param username - The username of the user to add as an editor.
929
- */
930
- export declare function addEditorToWikiPage(subredditName: string, page: string, username: string): Promise<void>;
931
- /**
932
- * Remove an editor from a wiki page.
933
- *
934
- * @param subredditName - The name of the subreddit the wiki is in.
935
- * @param page - The name of the wiki page to remove the editor from.
936
- * @param username - The username of the user to remove as an editor.
937
- */
938
- export declare function removeEditorFromWikiPage(subredditName: string, page: string, username: string): Promise<void>;
939
- /**
940
- * Get private messages sent to the currently authenticated user.
941
- *
942
- * @param options - Options for the request
943
- * @param options.type - The type of messages to get.
944
- */
945
- export declare function getMessages(options: GetPrivateMessagesOptions): Promise<Listing<PrivateMessage>>;
946
- /**
947
- * Mark all private messages as read.
948
- *
949
- */
950
- export declare function markAllMessagesAsRead(): Promise<void>;
951
- /**
952
- * Report a Post or Comment
953
- *
954
- * The report is sent to the moderators of the subreddit for review.
955
- *
956
- * @param thing Post or Comment
957
- * @param options Options
958
- * @param options.reason Why the thing is reported
959
- *
960
- * @example
961
- * ```ts
962
- * await report(post, {
963
- * reason: 'This is spam!',
964
- * })
965
- * ```
966
- */
967
- export declare function report(thing: Post | Comment, options: {
968
- reason: string;
969
- }): Promise<JsonStatus>;
970
- /**
971
- * Return a listing of things requiring moderator review, such as reported things and items.
972
- *
973
- * @param options
974
- *
975
- * @example
976
- * ```ts
977
- * const subreddit = await getSubredditByName("mysubreddit")
978
- * let listing = await subreddit.getModQueue();
979
- * console.log("Posts and Comments: ", await listing.all())
980
- * listing = await subreddit.getModQueue({ type: "post"});
981
- * console.log("Posts: ", await listing.all())
982
- * ```
983
- */
984
- export declare function getModQueue(options: ModLogOptions<'comment'>): Listing<Comment>;
985
- export declare function getModQueue(options: ModLogOptions<'post'>): Listing<Post>;
986
- export declare function getModQueue(options: ModLogOptions<'all'>): Listing<Post | Comment>;
987
- /**
988
- * Return a listing of things that have been reported.
989
- *
990
- * @param options
991
- *
992
- * @example
993
- * ```ts
994
- * const subreddit = await getSubredditByName("mysubreddit")
995
- * let listing = await subreddit.getReports();
996
- * console.log("Posts and Comments: ", await listing.all())
997
- * listing = await subreddit.getReports({ type: "post"});
998
- * console.log("Posts: ", await listing.all())
999
- * ```
1000
- */
1001
- export declare function getReports(options: ModLogOptions<'comment'>): Listing<Comment>;
1002
- export declare function getReports(options: ModLogOptions<'post'>): Listing<Post>;
1003
- export declare function getReports(options: ModLogOptions<'all'>): Listing<Post | Comment>;
1004
- /**
1005
- * Return a listing of things that have been marked as spam or otherwise removed.
1006
- *
1007
- * @param options
1008
- *
1009
- * @example
1010
- * ```ts
1011
- * const subreddit = await getSubredditByName("mysubreddit")
1012
- * let listing = await subreddit.getSpam();
1013
- * console.log("Posts and Comments: ", await listing.all())
1014
- * listing = await subreddit.getSpam({ type: "post"});
1015
- * console.log("Posts: ", await listing.all())
1016
- * ```
1017
- */
1018
- export declare function getSpam(options: ModLogOptions<'comment'>): Listing<Comment>;
1019
- export declare function getSpam(options: ModLogOptions<'post'>): Listing<Post>;
1020
- export declare function getSpam(options: ModLogOptions<'all'>): Listing<Post | Comment>;
1021
- /**
1022
- * Return a listing of things that have yet to be approved/removed by a mod.
1023
- *
1024
- * @param options
1025
- *
1026
- * @example
1027
- * ```ts
1028
- * const subreddit = await getSubredditByName("mysubreddit")
1029
- * let listing = await subreddit.getUnmoderated();
1030
- * console.log("Posts and Comments: ", await listing.all())
1031
- * listing = await subreddit.getUnmoderated({ type: "post"});
1032
- * console.log("Posts: ", await listing.all())
1033
- * ```
1034
- */
1035
- export declare function getUnmoderated(options: ModLogOptions<'comment'>): Listing<Comment>;
1036
- export declare function getUnmoderated(options: ModLogOptions<'post'>): Listing<Post>;
1037
- export declare function getUnmoderated(options: ModLogOptions<'all'>): Listing<Post | Comment>;
1038
- /**
1039
- * Return a listing of things that have been edited recently.
1040
- *
1041
- * @param options
1042
- *
1043
- * @example
1044
- * ```ts
1045
- * const subreddit = await getSubredditByName("mysubreddit")
1046
- * let listing = await subreddit.getEdited();
1047
- * console.log("Posts and Comments: ", await listing.all())
1048
- * listing = await subreddit.getEdited({ type: "post"});
1049
- * console.log("Posts: ", await listing.all())
1050
- * ```
1051
- */
1052
- export declare function getEdited(options: ModLogOptions<'comment'>): Listing<Comment>;
1053
- export declare function getEdited(options: ModLogOptions<'post'>): Listing<Post>;
1054
- export declare function getEdited(options: ModLogOptions<'all'>): Listing<Post | Comment>;
1055
- /**
1056
- * Gets a {@link Vault} for the specified address.
1057
- *
1058
- * @param {string} address - The address (starting with 0x) of the Vault.
1059
- * @example
1060
- * ```ts
1061
- * const vault = await getVaultByAddress('0x205ee28744456bDBf180A0Fa7De51e0F116d54Ed');
1062
- * ```
1063
- */
1064
- export declare function getVaultByAddress(address: string): Promise<Vault>;
1065
- /**
1066
- * Gets a {@link Vault} for the specified user.
1067
- *
1068
- * @param {string} userId - The ID (starting with t2_) of the Vault owner.
1069
- * @example
1070
- * ```ts
1071
- * const vault = await getVaultByUserId('t2_1w72');
1072
- * ```
1073
- */
1074
- export declare function getVaultByUserId(userId: string): Promise<Vault>;
1075
- /**
1076
- * Returns a leaderboard for a given subreddit ID.
1077
- *
1078
- * @param subredditId ID of the subreddit for which the leaderboard is being queried.
1079
- *
1080
- * @returns {SubredditLeaderboard} Leaderboard for the given subreddit.
1081
- */
1082
- export declare function getSubredditLeaderboard(subredditId: string): Promise<SubredditLeaderboard>;
1083
- /**
1084
- * Returns the styles for a given subreddit ID.
1085
- *
1086
- * @param subredditId ID of the subreddit from which to retrieve the styles.
1087
- *
1088
- * @returns {SubredditStyles} Styles for the given subreddit.
1089
- */
1090
- export declare function getSubredditStyles(subredditId: string): Promise<SubredditStyles>;
1091
- /**
1092
- * Subscribes to the subreddit in which the app is installed. No-op if the user is already subscribed.
1093
- * This method will execute as the app account by default.
1094
- * To subscribe on behalf of a user, please contact Reddit.
1095
- */
1096
- export declare function subscribeToCurrentSubreddit(): Promise<void>;
1097
- /**
1098
- * Unsubscribes from the subreddit in which the app is installed. No-op if the user isn't subscribed.
1099
- * This method will execute as the app account by default.
1100
- * To unsubscribe on behalf of a user, please contact Reddit.
1101
- */
1102
- export declare function unsubscribeFromCurrentSubreddit(): Promise<void>;
1103
- export {};
1104
- //# sourceMappingURL=index.d.ts.map