@devvit/public-api 0.12.0-next-2025-04-10-a27f59c35.0 → 0.12.0-next-2025-04-10-eddbfb660.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/apis/reddit/RedditAPIClient.d.ts +40 -40
- package/apis/reddit/RedditAPIClient.js +35 -35
- package/apis/reddit/models/Flair.js +1 -1
- package/apis/reddit/models/ModMail.d.ts +23 -23
- package/apis/reddit/models/ModMail.js +23 -23
- package/apis/reddit/models/Post.d.ts +4 -4
- package/apis/reddit/models/Post.js +4 -4
- package/apis/reddit/models/Subreddit.d.ts +7 -7
- package/apis/reddit/models/Subreddit.js +2 -2
- package/apis/reddit/models/User.d.ts +1 -1
- package/apis/reddit/models/User.js +1 -1
- package/devvit/Devvit.d.ts +1 -1
- package/devvit/Devvit.js +1 -1
- package/meta.json +14 -14
- package/meta.min.json +8 -8
- package/package.json +7 -7
- package/public-api.d.ts +37 -37
- package/public-api.iife.js +33 -33
- package/public-api.min.js.map +1 -1
- package/types/media.d.ts +1 -1
|
@@ -33,8 +33,8 @@ export type MuteUserOptions = {
|
|
|
33
33
|
|
|
34
34
|
* // use within one of our capability handlers e.g. Menu Actions, Triggers, Scheduled Job Type, etc
|
|
35
35
|
* async (event, context) => {
|
|
36
|
-
* const subreddit = await
|
|
37
|
-
*
|
|
36
|
+
* const subreddit = await getSubredditById(context.subredditId);
|
|
37
|
+
* submitPost({
|
|
38
38
|
* subredditName: subreddit.name,
|
|
39
39
|
* title: 'test post',
|
|
40
40
|
* text: 'test body',
|
|
@@ -51,7 +51,7 @@ export declare class _RedditAPIClient {
|
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
|
-
* await
|
|
54
|
+
* await modMail().reply({
|
|
55
55
|
* body: "Here is my message",
|
|
56
56
|
* conversationId: "abcd42";
|
|
57
57
|
* })
|
|
@@ -66,7 +66,7 @@ export declare class _RedditAPIClient {
|
|
|
66
66
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
67
67
|
* @example
|
|
68
68
|
* ```ts
|
|
69
|
-
* const memes = await
|
|
69
|
+
* const memes = await getSubredditById('t5_2qjpg');
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
getSubredditById(id: string): Promise<Subreddit | undefined>;
|
|
@@ -77,7 +77,7 @@ export declare class _RedditAPIClient {
|
|
|
77
77
|
* @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
|
|
78
78
|
* @example
|
|
79
79
|
* ```ts
|
|
80
|
-
* const memes = await
|
|
80
|
+
* const memes = await getSubredditInfoById('t5_2qjpg');
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
83
|
getSubredditInfoById(id: string): Promise<SubredditInfo>;
|
|
@@ -89,7 +89,7 @@ export declare class _RedditAPIClient {
|
|
|
89
89
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
90
90
|
* @example
|
|
91
91
|
* ```ts
|
|
92
|
-
* const askReddit = await
|
|
92
|
+
* const askReddit = await getSubredditByName('askReddit');
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
95
|
getSubredditByName(name: string): Promise<Subreddit>;
|
|
@@ -100,7 +100,7 @@ export declare class _RedditAPIClient {
|
|
|
100
100
|
* @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
103
|
-
* const askReddit = await
|
|
103
|
+
* const askReddit = await getSubredditInfoByName('askReddit');
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
106
|
getSubredditInfoByName(name: string): Promise<SubredditInfo>;
|
|
@@ -113,7 +113,7 @@ export declare class _RedditAPIClient {
|
|
|
113
113
|
* @param options.message The message associated with the removal reason.
|
|
114
114
|
* @example
|
|
115
115
|
* ```ts
|
|
116
|
-
* const newReason = await
|
|
116
|
+
* const newReason = await addSubredditRemovalReasons(
|
|
117
117
|
* 'askReddit',
|
|
118
118
|
* {
|
|
119
119
|
* title: 'Spam',
|
|
@@ -135,7 +135,7 @@ export declare class _RedditAPIClient {
|
|
|
135
135
|
* @param subredditName
|
|
136
136
|
* @example
|
|
137
137
|
* ```ts
|
|
138
|
-
* const reasons = await
|
|
138
|
+
* const reasons = await getSubredditRemovalReasons('askReddit');
|
|
139
139
|
*
|
|
140
140
|
* for (let reason of reasons) {
|
|
141
141
|
* console.log(reason.id, reason.message, reason.title)
|
|
@@ -151,7 +151,7 @@ export declare class _RedditAPIClient {
|
|
|
151
151
|
* @returns {Promise<string>} A Promise that resolves a string representing the current subreddit's name.
|
|
152
152
|
* @example
|
|
153
153
|
* ```ts
|
|
154
|
-
* const currentSubredditName = await
|
|
154
|
+
* const currentSubredditName = await getCurrentSubredditName();
|
|
155
155
|
* ```
|
|
156
156
|
*/
|
|
157
157
|
getCurrentSubredditName(): Promise<string>;
|
|
@@ -161,7 +161,7 @@ export declare class _RedditAPIClient {
|
|
|
161
161
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
162
162
|
* @example
|
|
163
163
|
* ```ts
|
|
164
|
-
* const currentSubreddit = await
|
|
164
|
+
* const currentSubreddit = await getCurrentSubreddit();
|
|
165
165
|
* ```
|
|
166
166
|
*/
|
|
167
167
|
getCurrentSubreddit(): Promise<Subreddit>;
|
|
@@ -179,7 +179,7 @@ export declare class _RedditAPIClient {
|
|
|
179
179
|
* @returns A Promise that resolves to a Post object.
|
|
180
180
|
* @example
|
|
181
181
|
* ```ts
|
|
182
|
-
* const post = await
|
|
182
|
+
* const post = await submitPost({
|
|
183
183
|
* subredditName: 'devvit',
|
|
184
184
|
* title: 'Hello World',
|
|
185
185
|
* richtext: new RichTextBuilder()
|
|
@@ -197,14 +197,14 @@ export declare class _RedditAPIClient {
|
|
|
197
197
|
* ```ts
|
|
198
198
|
* import { RunAs } from '@devvit/public-api';
|
|
199
199
|
*
|
|
200
|
-
* const post = await
|
|
200
|
+
* const post = await submitPost({
|
|
201
201
|
* title: 'My Devvit Post',
|
|
202
202
|
* runAs: RunAs.USER,
|
|
203
203
|
* userGeneratedContent: {
|
|
204
204
|
* text: "hello there",
|
|
205
205
|
* imageUrls: ["https://styles.redditmedia.com/t5_5wa5ww/styles/communityIcon_wyopomb2xb0a1.png", "https://styles.redditmedia.com/t5_49fkib/styles/bannerBackgroundImage_5a4axis7cku61.png"]
|
|
206
206
|
},
|
|
207
|
-
* subredditName: await
|
|
207
|
+
* subredditName: await getCurrentSubredditName(),
|
|
208
208
|
* textFallback: {
|
|
209
209
|
* text: 'This is a Devvit post!',
|
|
210
210
|
* },
|
|
@@ -234,7 +234,7 @@ export declare class _RedditAPIClient {
|
|
|
234
234
|
* @returns A Promise that resolves to a User object.
|
|
235
235
|
* @example
|
|
236
236
|
* ```ts
|
|
237
|
-
* const user = await
|
|
237
|
+
* const user = await getUserById('t2_1qjpg');
|
|
238
238
|
* ```
|
|
239
239
|
*/
|
|
240
240
|
getUserById(id: string): Promise<User | undefined>;
|
|
@@ -246,7 +246,7 @@ export declare class _RedditAPIClient {
|
|
|
246
246
|
* not found (user doesn't exist, account suspended, etc).
|
|
247
247
|
* @example
|
|
248
248
|
* ```ts
|
|
249
|
-
* const user = await
|
|
249
|
+
* const user = await getUserByUsername('devvit');
|
|
250
250
|
* if (user) {
|
|
251
251
|
* console.log(user)
|
|
252
252
|
* }
|
|
@@ -260,7 +260,7 @@ export declare class _RedditAPIClient {
|
|
|
260
260
|
* @returns A Promise that resolves to a string representing the username or undefined
|
|
261
261
|
* @example
|
|
262
262
|
* ```ts
|
|
263
|
-
* const username = await
|
|
263
|
+
* const username = await getCurrentUsername();
|
|
264
264
|
* ```
|
|
265
265
|
*/
|
|
266
266
|
getCurrentUsername(): Promise<string | undefined>;
|
|
@@ -271,7 +271,7 @@ export declare class _RedditAPIClient {
|
|
|
271
271
|
* @returns A Promise that resolves to a User object or undefined
|
|
272
272
|
* @example
|
|
273
273
|
* ```ts
|
|
274
|
-
* const user = await
|
|
274
|
+
* const user = await getCurrentUser();
|
|
275
275
|
* ```
|
|
276
276
|
*/
|
|
277
277
|
getCurrentUser(): Promise<User | undefined>;
|
|
@@ -281,7 +281,7 @@ export declare class _RedditAPIClient {
|
|
|
281
281
|
* @returns A Promise that resolves to a User object.
|
|
282
282
|
* @example
|
|
283
283
|
* ```ts
|
|
284
|
-
* const user = await
|
|
284
|
+
* const user = await getAppUser(metadata);
|
|
285
285
|
* ```
|
|
286
286
|
*/
|
|
287
287
|
getAppUser(): Promise<User>;
|
|
@@ -299,7 +299,7 @@ export declare class _RedditAPIClient {
|
|
|
299
299
|
* @returns A Promise that resolves to a Comment object.
|
|
300
300
|
* @example
|
|
301
301
|
* ```ts
|
|
302
|
-
* const comment = await
|
|
302
|
+
* const comment = await getCommentById('t1_1qjpg');
|
|
303
303
|
* ```
|
|
304
304
|
*/
|
|
305
305
|
getCommentById(id: string): Promise<Comment>;
|
|
@@ -315,7 +315,7 @@ export declare class _RedditAPIClient {
|
|
|
315
315
|
* @returns A Listing of Comment objects.
|
|
316
316
|
* @example
|
|
317
317
|
* ```ts
|
|
318
|
-
* const comments = await
|
|
318
|
+
* const comments = await getComments({
|
|
319
319
|
* postId: 't3_1qjpg',
|
|
320
320
|
* limit: 1000,
|
|
321
321
|
* pageSize: 100
|
|
@@ -348,7 +348,7 @@ export declare class _RedditAPIClient {
|
|
|
348
348
|
* ```ts
|
|
349
349
|
* import { RunAs } from '@devvit/public-api';
|
|
350
350
|
*
|
|
351
|
-
* const comment = await
|
|
351
|
+
* const comment = await submitComment({
|
|
352
352
|
* id: 't1_1qgif',
|
|
353
353
|
* text: 'Hello world!',
|
|
354
354
|
* runAs: RunAs.APP,
|
|
@@ -369,7 +369,7 @@ export declare class _RedditAPIClient {
|
|
|
369
369
|
* @returns A Listing of Post objects.
|
|
370
370
|
* @example
|
|
371
371
|
* ```ts
|
|
372
|
-
* const posts = await
|
|
372
|
+
* const posts = await getControversialPosts({
|
|
373
373
|
* subredditName: 'memes',
|
|
374
374
|
* timeframe: 'day',
|
|
375
375
|
* limit: 1000,
|
|
@@ -389,7 +389,7 @@ export declare class _RedditAPIClient {
|
|
|
389
389
|
* @returns A Listing of Post objects.
|
|
390
390
|
* @example
|
|
391
391
|
* ```ts
|
|
392
|
-
* const posts = await
|
|
392
|
+
* const posts = await getControversialPosts({
|
|
393
393
|
* subredditName: 'memes',
|
|
394
394
|
* timeframe: 'day',
|
|
395
395
|
* limit: 1000,
|
|
@@ -409,7 +409,7 @@ export declare class _RedditAPIClient {
|
|
|
409
409
|
* @returns A Listing of Post objects.
|
|
410
410
|
* @example
|
|
411
411
|
* ```ts
|
|
412
|
-
* const posts = await
|
|
412
|
+
* const posts = await getHotPosts({
|
|
413
413
|
* subredditName: 'memes',
|
|
414
414
|
* timeframe: 'day',
|
|
415
415
|
* limit: 1000,
|
|
@@ -428,7 +428,7 @@ export declare class _RedditAPIClient {
|
|
|
428
428
|
* @returns A Listing of Post objects.
|
|
429
429
|
* @example
|
|
430
430
|
* ```ts
|
|
431
|
-
* const posts = await
|
|
431
|
+
* const posts = await getNewPosts({
|
|
432
432
|
* subredditName: 'memes',
|
|
433
433
|
* limit: 1000,
|
|
434
434
|
* pageSize: 100
|
|
@@ -447,7 +447,7 @@ export declare class _RedditAPIClient {
|
|
|
447
447
|
* @returns A Listing of Post objects.
|
|
448
448
|
* @example
|
|
449
449
|
* ```ts
|
|
450
|
-
* const posts = await
|
|
450
|
+
* const posts = await getRisingPosts({
|
|
451
451
|
* subredditName: 'memes',
|
|
452
452
|
* timeframe: 'day',
|
|
453
453
|
* limit: 1000,
|
|
@@ -492,7 +492,7 @@ export declare class _RedditAPIClient {
|
|
|
492
492
|
* @returns A Listing of ModAction objects.
|
|
493
493
|
* @example
|
|
494
494
|
* ```ts
|
|
495
|
-
* const modActions = await
|
|
495
|
+
* const modActions = await getModerationLog({
|
|
496
496
|
* subredditName: 'memes',
|
|
497
497
|
* moderatorUsernames: ['spez'],
|
|
498
498
|
* type: 'banuser',
|
|
@@ -741,8 +741,8 @@ export declare class _RedditAPIClient {
|
|
|
741
741
|
* @param id - The id of the post (t3_) or comment (t1_) to approve.
|
|
742
742
|
* @example
|
|
743
743
|
* ```ts
|
|
744
|
-
* await
|
|
745
|
-
* await
|
|
744
|
+
* await approve('t3_123456');
|
|
745
|
+
* await approve('t1_123456');
|
|
746
746
|
* ```
|
|
747
747
|
*/
|
|
748
748
|
approve(id: string): Promise<void>;
|
|
@@ -753,8 +753,8 @@ export declare class _RedditAPIClient {
|
|
|
753
753
|
* @param isSpam - Is the post or comment being removed because it's spam?
|
|
754
754
|
* @example
|
|
755
755
|
* ```ts
|
|
756
|
-
* await
|
|
757
|
-
* await
|
|
756
|
+
* await remove('t3_123456', false);
|
|
757
|
+
* await remove('t1_123456', true);
|
|
758
758
|
* ```
|
|
759
759
|
*/
|
|
760
760
|
remove(id: string, isSpam: boolean): Promise<void>;
|
|
@@ -1019,7 +1019,7 @@ export declare class _RedditAPIClient {
|
|
|
1019
1019
|
*
|
|
1020
1020
|
* @example
|
|
1021
1021
|
* ```ts
|
|
1022
|
-
* await
|
|
1022
|
+
* await report(post, {
|
|
1023
1023
|
* reason: 'This is spam!',
|
|
1024
1024
|
* })
|
|
1025
1025
|
* ```
|
|
@@ -1034,7 +1034,7 @@ export declare class _RedditAPIClient {
|
|
|
1034
1034
|
*
|
|
1035
1035
|
* @example
|
|
1036
1036
|
* ```ts
|
|
1037
|
-
* const subreddit = await
|
|
1037
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
1038
1038
|
* let listing = await subreddit.getModQueue();
|
|
1039
1039
|
* console.log("Posts and Comments: ", await listing.all())
|
|
1040
1040
|
* listing = await subreddit.getModQueue({ type: "post"});
|
|
@@ -1051,7 +1051,7 @@ export declare class _RedditAPIClient {
|
|
|
1051
1051
|
*
|
|
1052
1052
|
* @example
|
|
1053
1053
|
* ```ts
|
|
1054
|
-
* const subreddit = await
|
|
1054
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
1055
1055
|
* let listing = await subreddit.getReports();
|
|
1056
1056
|
* console.log("Posts and Comments: ", await listing.all())
|
|
1057
1057
|
* listing = await subreddit.getReports({ type: "post"});
|
|
@@ -1068,7 +1068,7 @@ export declare class _RedditAPIClient {
|
|
|
1068
1068
|
*
|
|
1069
1069
|
* @example
|
|
1070
1070
|
* ```ts
|
|
1071
|
-
* const subreddit = await
|
|
1071
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
1072
1072
|
* let listing = await subreddit.getSpam();
|
|
1073
1073
|
* console.log("Posts and Comments: ", await listing.all())
|
|
1074
1074
|
* listing = await subreddit.getSpam({ type: "post"});
|
|
@@ -1085,7 +1085,7 @@ export declare class _RedditAPIClient {
|
|
|
1085
1085
|
*
|
|
1086
1086
|
* @example
|
|
1087
1087
|
* ```ts
|
|
1088
|
-
* const subreddit = await
|
|
1088
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
1089
1089
|
* let listing = await subreddit.getUnmoderated();
|
|
1090
1090
|
* console.log("Posts and Comments: ", await listing.all())
|
|
1091
1091
|
* listing = await subreddit.getUnmoderated({ type: "post"});
|
|
@@ -1102,7 +1102,7 @@ export declare class _RedditAPIClient {
|
|
|
1102
1102
|
*
|
|
1103
1103
|
* @example
|
|
1104
1104
|
* ```ts
|
|
1105
|
-
* const subreddit = await
|
|
1105
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
1106
1106
|
* let listing = await subreddit.getEdited();
|
|
1107
1107
|
* console.log("Posts and Comments: ", await listing.all())
|
|
1108
1108
|
* listing = await subreddit.getEdited({ type: "post"});
|
|
@@ -1118,7 +1118,7 @@ export declare class _RedditAPIClient {
|
|
|
1118
1118
|
* @param {string} address - The address (starting with 0x) of the Vault.
|
|
1119
1119
|
* @example
|
|
1120
1120
|
* ```ts
|
|
1121
|
-
* const vault = await
|
|
1121
|
+
* const vault = await getVaultByAddress('0x205ee28744456bDBf180A0Fa7De51e0F116d54Ed');
|
|
1122
1122
|
* ```
|
|
1123
1123
|
*/
|
|
1124
1124
|
getVaultByAddress(address: string): Promise<Vault>;
|
|
@@ -1128,7 +1128,7 @@ export declare class _RedditAPIClient {
|
|
|
1128
1128
|
* @param {string} userId - The ID (starting with t2_) of the Vault owner.
|
|
1129
1129
|
* @example
|
|
1130
1130
|
* ```ts
|
|
1131
|
-
* const vault = await
|
|
1131
|
+
* const vault = await getVaultByUserId('t2_1w72');
|
|
1132
1132
|
* ```
|
|
1133
1133
|
*/
|
|
1134
1134
|
getVaultByUserId(userId: string): Promise<Vault>;
|
|
@@ -31,8 +31,8 @@ import { getVaultByAddress, getVaultByUserId } from './models/Vault.js';
|
|
|
31
31
|
|
|
32
32
|
* // use within one of our capability handlers e.g. Menu Actions, Triggers, Scheduled Job Type, etc
|
|
33
33
|
* async (event, context) => {
|
|
34
|
-
* const subreddit = await
|
|
35
|
-
*
|
|
34
|
+
* const subreddit = await getSubredditById(context.subredditId);
|
|
35
|
+
* submitPost({
|
|
36
36
|
* subredditName: subreddit.name,
|
|
37
37
|
* title: 'test post',
|
|
38
38
|
* text: 'test body',
|
|
@@ -55,7 +55,7 @@ export class _RedditAPIClient {
|
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts
|
|
58
|
-
* await
|
|
58
|
+
* await modMail().reply({
|
|
59
59
|
* body: "Here is my message",
|
|
60
60
|
* conversationId: "abcd42";
|
|
61
61
|
* })
|
|
@@ -72,7 +72,7 @@ export class _RedditAPIClient {
|
|
|
72
72
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
73
73
|
* @example
|
|
74
74
|
* ```ts
|
|
75
|
-
* const memes = await
|
|
75
|
+
* const memes = await getSubredditById('t5_2qjpg');
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
78
|
getSubredditById(id) {
|
|
@@ -85,7 +85,7 @@ export class _RedditAPIClient {
|
|
|
85
85
|
* @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
|
|
86
86
|
* @example
|
|
87
87
|
* ```ts
|
|
88
|
-
* const memes = await
|
|
88
|
+
* const memes = await getSubredditInfoById('t5_2qjpg');
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
91
|
getSubredditInfoById(id) {
|
|
@@ -99,7 +99,7 @@ export class _RedditAPIClient {
|
|
|
99
99
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
100
100
|
* @example
|
|
101
101
|
* ```ts
|
|
102
|
-
* const askReddit = await
|
|
102
|
+
* const askReddit = await getSubredditByName('askReddit');
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
105
|
getSubredditByName(name) {
|
|
@@ -112,7 +112,7 @@ export class _RedditAPIClient {
|
|
|
112
112
|
* @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
|
|
113
113
|
* @example
|
|
114
114
|
* ```ts
|
|
115
|
-
* const askReddit = await
|
|
115
|
+
* const askReddit = await getSubredditInfoByName('askReddit');
|
|
116
116
|
* ```
|
|
117
117
|
*/
|
|
118
118
|
getSubredditInfoByName(name) {
|
|
@@ -127,7 +127,7 @@ export class _RedditAPIClient {
|
|
|
127
127
|
* @param options.message The message associated with the removal reason.
|
|
128
128
|
* @example
|
|
129
129
|
* ```ts
|
|
130
|
-
* const newReason = await
|
|
130
|
+
* const newReason = await addSubredditRemovalReasons(
|
|
131
131
|
* 'askReddit',
|
|
132
132
|
* {
|
|
133
133
|
* title: 'Spam',
|
|
@@ -148,7 +148,7 @@ export class _RedditAPIClient {
|
|
|
148
148
|
* @param subredditName
|
|
149
149
|
* @example
|
|
150
150
|
* ```ts
|
|
151
|
-
* const reasons = await
|
|
151
|
+
* const reasons = await getSubredditRemovalReasons('askReddit');
|
|
152
152
|
*
|
|
153
153
|
* for (let reason of reasons) {
|
|
154
154
|
* console.log(reason.id, reason.message, reason.title)
|
|
@@ -166,7 +166,7 @@ export class _RedditAPIClient {
|
|
|
166
166
|
* @returns {Promise<string>} A Promise that resolves a string representing the current subreddit's name.
|
|
167
167
|
* @example
|
|
168
168
|
* ```ts
|
|
169
|
-
* const currentSubredditName = await
|
|
169
|
+
* const currentSubredditName = await getCurrentSubredditName();
|
|
170
170
|
* ```
|
|
171
171
|
*/
|
|
172
172
|
async getCurrentSubredditName() {
|
|
@@ -187,7 +187,7 @@ export class _RedditAPIClient {
|
|
|
187
187
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
188
188
|
* @example
|
|
189
189
|
* ```ts
|
|
190
|
-
* const currentSubreddit = await
|
|
190
|
+
* const currentSubreddit = await getCurrentSubreddit();
|
|
191
191
|
* ```
|
|
192
192
|
*/
|
|
193
193
|
async getCurrentSubreddit() {
|
|
@@ -213,7 +213,7 @@ export class _RedditAPIClient {
|
|
|
213
213
|
* @returns A Promise that resolves to a Post object.
|
|
214
214
|
* @example
|
|
215
215
|
* ```ts
|
|
216
|
-
* const post = await
|
|
216
|
+
* const post = await submitPost({
|
|
217
217
|
* subredditName: 'devvit',
|
|
218
218
|
* title: 'Hello World',
|
|
219
219
|
* richtext: new RichTextBuilder()
|
|
@@ -231,14 +231,14 @@ export class _RedditAPIClient {
|
|
|
231
231
|
* ```ts
|
|
232
232
|
* import { RunAs } from '@devvit/public-api';
|
|
233
233
|
*
|
|
234
|
-
* const post = await
|
|
234
|
+
* const post = await submitPost({
|
|
235
235
|
* title: 'My Devvit Post',
|
|
236
236
|
* runAs: RunAs.USER,
|
|
237
237
|
* userGeneratedContent: {
|
|
238
238
|
* text: "hello there",
|
|
239
239
|
* imageUrls: ["https://styles.redditmedia.com/t5_5wa5ww/styles/communityIcon_wyopomb2xb0a1.png", "https://styles.redditmedia.com/t5_49fkib/styles/bannerBackgroundImage_5a4axis7cku61.png"]
|
|
240
240
|
},
|
|
241
|
-
* subredditName: await
|
|
241
|
+
* subredditName: await getCurrentSubredditName(),
|
|
242
242
|
* textFallback: {
|
|
243
243
|
* text: 'This is a Devvit post!',
|
|
244
244
|
* },
|
|
@@ -272,7 +272,7 @@ export class _RedditAPIClient {
|
|
|
272
272
|
* @returns A Promise that resolves to a User object.
|
|
273
273
|
* @example
|
|
274
274
|
* ```ts
|
|
275
|
-
* const user = await
|
|
275
|
+
* const user = await getUserById('t2_1qjpg');
|
|
276
276
|
* ```
|
|
277
277
|
*/
|
|
278
278
|
getUserById(id) {
|
|
@@ -286,7 +286,7 @@ export class _RedditAPIClient {
|
|
|
286
286
|
* not found (user doesn't exist, account suspended, etc).
|
|
287
287
|
* @example
|
|
288
288
|
* ```ts
|
|
289
|
-
* const user = await
|
|
289
|
+
* const user = await getUserByUsername('devvit');
|
|
290
290
|
* if (user) {
|
|
291
291
|
* console.log(user)
|
|
292
292
|
* }
|
|
@@ -302,7 +302,7 @@ export class _RedditAPIClient {
|
|
|
302
302
|
* @returns A Promise that resolves to a string representing the username or undefined
|
|
303
303
|
* @example
|
|
304
304
|
* ```ts
|
|
305
|
-
* const username = await
|
|
305
|
+
* const username = await getCurrentUsername();
|
|
306
306
|
* ```
|
|
307
307
|
*/
|
|
308
308
|
async getCurrentUsername() {
|
|
@@ -316,7 +316,7 @@ export class _RedditAPIClient {
|
|
|
316
316
|
* @returns A Promise that resolves to a User object or undefined
|
|
317
317
|
* @example
|
|
318
318
|
* ```ts
|
|
319
|
-
* const user = await
|
|
319
|
+
* const user = await getCurrentUser();
|
|
320
320
|
* ```
|
|
321
321
|
*/
|
|
322
322
|
async getCurrentUser() {
|
|
@@ -329,7 +329,7 @@ export class _RedditAPIClient {
|
|
|
329
329
|
* @returns A Promise that resolves to a User object.
|
|
330
330
|
* @example
|
|
331
331
|
* ```ts
|
|
332
|
-
* const user = await
|
|
332
|
+
* const user = await getAppUser(metadata);
|
|
333
333
|
* ```
|
|
334
334
|
*/
|
|
335
335
|
getAppUser() {
|
|
@@ -351,7 +351,7 @@ export class _RedditAPIClient {
|
|
|
351
351
|
* @returns A Promise that resolves to a Comment object.
|
|
352
352
|
* @example
|
|
353
353
|
* ```ts
|
|
354
|
-
* const comment = await
|
|
354
|
+
* const comment = await getCommentById('t1_1qjpg');
|
|
355
355
|
* ```
|
|
356
356
|
*/
|
|
357
357
|
getCommentById(id) {
|
|
@@ -369,7 +369,7 @@ export class _RedditAPIClient {
|
|
|
369
369
|
* @returns A Listing of Comment objects.
|
|
370
370
|
* @example
|
|
371
371
|
* ```ts
|
|
372
|
-
* const comments = await
|
|
372
|
+
* const comments = await getComments({
|
|
373
373
|
* postId: 't3_1qjpg',
|
|
374
374
|
* limit: 1000,
|
|
375
375
|
* pageSize: 100
|
|
@@ -406,7 +406,7 @@ export class _RedditAPIClient {
|
|
|
406
406
|
* ```ts
|
|
407
407
|
* import { RunAs } from '@devvit/public-api';
|
|
408
408
|
*
|
|
409
|
-
* const comment = await
|
|
409
|
+
* const comment = await submitComment({
|
|
410
410
|
* id: 't1_1qgif',
|
|
411
411
|
* text: 'Hello world!',
|
|
412
412
|
* runAs: RunAs.APP,
|
|
@@ -430,7 +430,7 @@ export class _RedditAPIClient {
|
|
|
430
430
|
* @returns A Listing of Post objects.
|
|
431
431
|
* @example
|
|
432
432
|
* ```ts
|
|
433
|
-
* const posts = await
|
|
433
|
+
* const posts = await getControversialPosts({
|
|
434
434
|
* subredditName: 'memes',
|
|
435
435
|
* timeframe: 'day',
|
|
436
436
|
* limit: 1000,
|
|
@@ -452,7 +452,7 @@ export class _RedditAPIClient {
|
|
|
452
452
|
* @returns A Listing of Post objects.
|
|
453
453
|
* @example
|
|
454
454
|
* ```ts
|
|
455
|
-
* const posts = await
|
|
455
|
+
* const posts = await getControversialPosts({
|
|
456
456
|
* subredditName: 'memes',
|
|
457
457
|
* timeframe: 'day',
|
|
458
458
|
* limit: 1000,
|
|
@@ -474,7 +474,7 @@ export class _RedditAPIClient {
|
|
|
474
474
|
* @returns A Listing of Post objects.
|
|
475
475
|
* @example
|
|
476
476
|
* ```ts
|
|
477
|
-
* const posts = await
|
|
477
|
+
* const posts = await getHotPosts({
|
|
478
478
|
* subredditName: 'memes',
|
|
479
479
|
* timeframe: 'day',
|
|
480
480
|
* limit: 1000,
|
|
@@ -495,7 +495,7 @@ export class _RedditAPIClient {
|
|
|
495
495
|
* @returns A Listing of Post objects.
|
|
496
496
|
* @example
|
|
497
497
|
* ```ts
|
|
498
|
-
* const posts = await
|
|
498
|
+
* const posts = await getNewPosts({
|
|
499
499
|
* subredditName: 'memes',
|
|
500
500
|
* limit: 1000,
|
|
501
501
|
* pageSize: 100
|
|
@@ -516,7 +516,7 @@ export class _RedditAPIClient {
|
|
|
516
516
|
* @returns A Listing of Post objects.
|
|
517
517
|
* @example
|
|
518
518
|
* ```ts
|
|
519
|
-
* const posts = await
|
|
519
|
+
* const posts = await getRisingPosts({
|
|
520
520
|
* subredditName: 'memes',
|
|
521
521
|
* timeframe: 'day',
|
|
522
522
|
* limit: 1000,
|
|
@@ -567,7 +567,7 @@ export class _RedditAPIClient {
|
|
|
567
567
|
* @returns A Listing of ModAction objects.
|
|
568
568
|
* @example
|
|
569
569
|
* ```ts
|
|
570
|
-
* const modActions = await
|
|
570
|
+
* const modActions = await getModerationLog({
|
|
571
571
|
* subredditName: 'memes',
|
|
572
572
|
* moderatorUsernames: ['spez'],
|
|
573
573
|
* type: 'banuser',
|
|
@@ -948,8 +948,8 @@ export class _RedditAPIClient {
|
|
|
948
948
|
* @param id - The id of the post (t3_) or comment (t1_) to approve.
|
|
949
949
|
* @example
|
|
950
950
|
* ```ts
|
|
951
|
-
* await
|
|
952
|
-
* await
|
|
951
|
+
* await approve('t3_123456');
|
|
952
|
+
* await approve('t1_123456');
|
|
953
953
|
* ```
|
|
954
954
|
*/
|
|
955
955
|
async approve(id) {
|
|
@@ -968,8 +968,8 @@ export class _RedditAPIClient {
|
|
|
968
968
|
* @param isSpam - Is the post or comment being removed because it's spam?
|
|
969
969
|
* @example
|
|
970
970
|
* ```ts
|
|
971
|
-
* await
|
|
972
|
-
* await
|
|
971
|
+
* await remove('t3_123456', false);
|
|
972
|
+
* await remove('t1_123456', true);
|
|
973
973
|
* ```
|
|
974
974
|
*/
|
|
975
975
|
async remove(id, isSpam) {
|
|
@@ -1296,7 +1296,7 @@ export class _RedditAPIClient {
|
|
|
1296
1296
|
*
|
|
1297
1297
|
* @example
|
|
1298
1298
|
* ```ts
|
|
1299
|
-
* await
|
|
1299
|
+
* await report(post, {
|
|
1300
1300
|
* reason: 'This is spam!',
|
|
1301
1301
|
* })
|
|
1302
1302
|
* ```
|
|
@@ -1346,7 +1346,7 @@ export class _RedditAPIClient {
|
|
|
1346
1346
|
* @param {string} address - The address (starting with 0x) of the Vault.
|
|
1347
1347
|
* @example
|
|
1348
1348
|
* ```ts
|
|
1349
|
-
* const vault = await
|
|
1349
|
+
* const vault = await getVaultByAddress('0x205ee28744456bDBf180A0Fa7De51e0F116d54Ed');
|
|
1350
1350
|
* ```
|
|
1351
1351
|
*/
|
|
1352
1352
|
getVaultByAddress(address) {
|
|
@@ -1358,7 +1358,7 @@ export class _RedditAPIClient {
|
|
|
1358
1358
|
* @param {string} userId - The ID (starting with t2_) of the Vault owner.
|
|
1359
1359
|
* @example
|
|
1360
1360
|
* ```ts
|
|
1361
|
-
* const vault = await
|
|
1361
|
+
* const vault = await getVaultByUserId('t2_1w72');
|
|
1362
1362
|
* ```
|
|
1363
1363
|
*/
|
|
1364
1364
|
getVaultByUserId(userId) {
|