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