@devvit/public-api 0.12.0-next-2025-04-10-a27f59c35.0 → 0.12.0-next-2025-04-10-14eb9113e.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
|
@@ -291,7 +291,7 @@ export declare class ModMailService {
|
|
|
291
291
|
*
|
|
292
292
|
* @example
|
|
293
293
|
* ```ts
|
|
294
|
-
* const conversationIds = await
|
|
294
|
+
* const conversationIds = await modMail().bulkReadConversations(
|
|
295
295
|
* ['askReddit', 'myAwesomeSubreddit'],
|
|
296
296
|
* 'filtered'
|
|
297
297
|
* );
|
|
@@ -309,7 +309,7 @@ export declare class ModMailService {
|
|
|
309
309
|
*
|
|
310
310
|
* @example
|
|
311
311
|
* ```ts
|
|
312
|
-
* const {viewerId, conversations} = await
|
|
312
|
+
* const {viewerId, conversations} = await modMail().getConversations({
|
|
313
313
|
* after: 'abcdef',
|
|
314
314
|
* limit: 42
|
|
315
315
|
* });
|
|
@@ -326,7 +326,7 @@ export declare class ModMailService {
|
|
|
326
326
|
*
|
|
327
327
|
* @example
|
|
328
328
|
* ```ts
|
|
329
|
-
* const { conversation, messages, modActions, user } = await
|
|
329
|
+
* const { conversation, messages, modActions, user } = await modMail().getConversation({ conversationId: 'abcdef', markRead: true });
|
|
330
330
|
* ```
|
|
331
331
|
*/
|
|
332
332
|
getConversation(params: {
|
|
@@ -340,7 +340,7 @@ export declare class ModMailService {
|
|
|
340
340
|
*
|
|
341
341
|
* @example
|
|
342
342
|
* ```ts
|
|
343
|
-
* const subredditsData = await
|
|
343
|
+
* const subredditsData = await modMail().getSubreddits();
|
|
344
344
|
*
|
|
345
345
|
* for (const subreddit of Object.values(subreddits)) {
|
|
346
346
|
* console.log(subreddit.id);
|
|
@@ -377,7 +377,7 @@ export declare class ModMailService {
|
|
|
377
377
|
*
|
|
378
378
|
* @example
|
|
379
379
|
* ```ts
|
|
380
|
-
* const { conversation, messages, modActions } = await
|
|
380
|
+
* const { conversation, messages, modActions } = await modMail().createConversation({
|
|
381
381
|
* subredditName: 'askReddit',
|
|
382
382
|
* subject: 'Test conversation',
|
|
383
383
|
* body: 'Lorem ipsum sit amet',
|
|
@@ -403,7 +403,7 @@ export declare class ModMailService {
|
|
|
403
403
|
* @returns A Promise that resolves a string representing the conversationId of the message.
|
|
404
404
|
* @example
|
|
405
405
|
* ```ts
|
|
406
|
-
* const conversationId = await
|
|
406
|
+
* const conversationId = await modMail().createModDiscussionConversation({
|
|
407
407
|
* subject: 'Test conversation',
|
|
408
408
|
* bodyMarkdown: '**Hello there** \n\n _Have a great day!_',
|
|
409
409
|
* subredditId: context.subredditId
|
|
@@ -424,7 +424,7 @@ export declare class ModMailService {
|
|
|
424
424
|
* @returns A Promise that resolves a string representing the conversationId of the message.
|
|
425
425
|
* @example
|
|
426
426
|
* ```ts
|
|
427
|
-
* const conversationId = await
|
|
427
|
+
* const conversationId = await modMail().createModInboxConversation({
|
|
428
428
|
* subject: 'Test conversation',
|
|
429
429
|
* bodyMarkdown: '**Hello there** \n\n _Have a great day!_',
|
|
430
430
|
* subredditId: context.subredditId
|
|
@@ -446,7 +446,7 @@ export declare class ModMailService {
|
|
|
446
446
|
* @returns A Promise that resolves a string representing the conversationId of the message.
|
|
447
447
|
* @example
|
|
448
448
|
* ```ts
|
|
449
|
-
* const conversationId = await
|
|
449
|
+
* const conversationId = await modMail().createModNotification({
|
|
450
450
|
* subject: 'Test notification',
|
|
451
451
|
* bodyMarkdown: '**Hello there** \n\n _This is a notification!_',
|
|
452
452
|
* subredditId: context.subredditId
|
|
@@ -468,7 +468,7 @@ export declare class ModMailService {
|
|
|
468
468
|
*
|
|
469
469
|
* @example
|
|
470
470
|
* ```ts
|
|
471
|
-
* await
|
|
471
|
+
* await modMail().reply({
|
|
472
472
|
* body: 'Lorem ipsum sit amet',
|
|
473
473
|
* conversationId: 'abcdef',
|
|
474
474
|
* });
|
|
@@ -487,7 +487,7 @@ export declare class ModMailService {
|
|
|
487
487
|
*
|
|
488
488
|
* @example
|
|
489
489
|
* ```ts
|
|
490
|
-
* await
|
|
490
|
+
* await modMail().highlightConversation('abcdef');
|
|
491
491
|
* ```
|
|
492
492
|
*/
|
|
493
493
|
highlightConversation(conversationId: string): Promise<ConversationResponse>;
|
|
@@ -498,7 +498,7 @@ export declare class ModMailService {
|
|
|
498
498
|
*
|
|
499
499
|
* @example
|
|
500
500
|
* ```ts
|
|
501
|
-
* await
|
|
501
|
+
* await modMail().unhighlightConversation('abcdef');
|
|
502
502
|
* ```
|
|
503
503
|
*/
|
|
504
504
|
unhighlightConversation(conversationId: string): Promise<ConversationResponse>;
|
|
@@ -509,7 +509,7 @@ export declare class ModMailService {
|
|
|
509
509
|
*
|
|
510
510
|
* @example
|
|
511
511
|
* ```ts
|
|
512
|
-
* await
|
|
512
|
+
* await modMail().archive('abcdef');
|
|
513
513
|
* ```
|
|
514
514
|
*/
|
|
515
515
|
archiveConversation(conversationId: string): Promise<ConversationResponse>;
|
|
@@ -520,7 +520,7 @@ export declare class ModMailService {
|
|
|
520
520
|
*
|
|
521
521
|
* @example
|
|
522
522
|
* ```ts
|
|
523
|
-
* await
|
|
523
|
+
* await modMail().unarchiveConversation('abcdef');
|
|
524
524
|
* ```
|
|
525
525
|
*/
|
|
526
526
|
unarchiveConversation(conversationId: string): Promise<ConversationResponse>;
|
|
@@ -532,7 +532,7 @@ export declare class ModMailService {
|
|
|
532
532
|
*
|
|
533
533
|
* @example
|
|
534
534
|
* ```ts
|
|
535
|
-
* await
|
|
535
|
+
* await modMail().muteConversation({ conversationId: 'abcdef', numHours: 72 });
|
|
536
536
|
* ```
|
|
537
537
|
*/
|
|
538
538
|
muteConversation(params: {
|
|
@@ -546,7 +546,7 @@ export declare class ModMailService {
|
|
|
546
546
|
*
|
|
547
547
|
* @example
|
|
548
548
|
* ```ts
|
|
549
|
-
* await
|
|
549
|
+
* await modMail().unmuteConversation('abcdef');
|
|
550
550
|
* ```
|
|
551
551
|
*/
|
|
552
552
|
unmuteConversation(conversationId: string): Promise<ConversationResponse & WithUserData>;
|
|
@@ -557,7 +557,7 @@ export declare class ModMailService {
|
|
|
557
557
|
*
|
|
558
558
|
* @example
|
|
559
559
|
* ```ts
|
|
560
|
-
* await
|
|
560
|
+
* await modMail().readConversations(['abcdef', 'qwerty']);
|
|
561
561
|
* ```
|
|
562
562
|
*/
|
|
563
563
|
readConversations(conversationIds: string[]): Promise<void>;
|
|
@@ -568,7 +568,7 @@ export declare class ModMailService {
|
|
|
568
568
|
*
|
|
569
569
|
* @example
|
|
570
570
|
* ```ts
|
|
571
|
-
* await
|
|
571
|
+
* await modMail().unreadConversations(['abcdef', 'qwerty']);
|
|
572
572
|
* ```
|
|
573
573
|
*/
|
|
574
574
|
unreadConversations(conversationIds: string[]): Promise<void>;
|
|
@@ -579,7 +579,7 @@ export declare class ModMailService {
|
|
|
579
579
|
*
|
|
580
580
|
* @example
|
|
581
581
|
* ```ts
|
|
582
|
-
* await
|
|
582
|
+
* await modMail().approveConversation('abcdef');
|
|
583
583
|
* ```
|
|
584
584
|
*/
|
|
585
585
|
approveConversation(conversationId: string): Promise<ConversationResponse & WithUserData>;
|
|
@@ -590,7 +590,7 @@ export declare class ModMailService {
|
|
|
590
590
|
*
|
|
591
591
|
* @example
|
|
592
592
|
* ```ts
|
|
593
|
-
* await
|
|
593
|
+
* await modMail().disapproveConversation('abcdef');
|
|
594
594
|
* ```
|
|
595
595
|
*/
|
|
596
596
|
disapproveConversation(conversationId: string): Promise<ConversationResponse & WithUserData>;
|
|
@@ -602,7 +602,7 @@ export declare class ModMailService {
|
|
|
602
602
|
*
|
|
603
603
|
* @example
|
|
604
604
|
* ```ts
|
|
605
|
-
* await
|
|
605
|
+
* await modMail().tempBanConversation({ conversationId: 'abcdef', duration: 42 });
|
|
606
606
|
* ```
|
|
607
607
|
*/
|
|
608
608
|
tempBanConversation(params: {
|
|
@@ -616,7 +616,7 @@ export declare class ModMailService {
|
|
|
616
616
|
*
|
|
617
617
|
* @example
|
|
618
618
|
* ```ts
|
|
619
|
-
* await
|
|
619
|
+
* await modMail().unbanConversation('abcdef');
|
|
620
620
|
* ```
|
|
621
621
|
*/
|
|
622
622
|
unbanConversation(conversationId: string): Promise<ConversationResponse & WithUserData>;
|
|
@@ -625,7 +625,7 @@ export declare class ModMailService {
|
|
|
625
625
|
*
|
|
626
626
|
* @example
|
|
627
627
|
* ```ts
|
|
628
|
-
* const response = await
|
|
628
|
+
* const response = await modMail().getUnreadCount();
|
|
629
629
|
*
|
|
630
630
|
* console.log(response.highlighted);
|
|
631
631
|
* console.log(response.new);
|
|
@@ -639,7 +639,7 @@ export declare class ModMailService {
|
|
|
639
639
|
*
|
|
640
640
|
* @example
|
|
641
641
|
* ```ts
|
|
642
|
-
* const data = await
|
|
642
|
+
* const data = await modMail().getUserConversations('abcdef');
|
|
643
643
|
*
|
|
644
644
|
* console.log(data.recentComments);
|
|
645
645
|
* console.log(data.recentPosts);
|
|
@@ -91,7 +91,7 @@ export class ModMailService {
|
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
93
|
* ```ts
|
|
94
|
-
* const conversationIds = await
|
|
94
|
+
* const conversationIds = await modMail().bulkReadConversations(
|
|
95
95
|
* ['askReddit', 'myAwesomeSubreddit'],
|
|
96
96
|
* 'filtered'
|
|
97
97
|
* );
|
|
@@ -116,7 +116,7 @@ export class ModMailService {
|
|
|
116
116
|
*
|
|
117
117
|
* @example
|
|
118
118
|
* ```ts
|
|
119
|
-
* const {viewerId, conversations} = await
|
|
119
|
+
* const {viewerId, conversations} = await modMail().getConversations({
|
|
120
120
|
* after: 'abcdef',
|
|
121
121
|
* limit: 42
|
|
122
122
|
* });
|
|
@@ -155,7 +155,7 @@ export class ModMailService {
|
|
|
155
155
|
*
|
|
156
156
|
* @example
|
|
157
157
|
* ```ts
|
|
158
|
-
* const { conversation, messages, modActions, user } = await
|
|
158
|
+
* const { conversation, messages, modActions, user } = await modMail().getConversation({ conversationId: 'abcdef', markRead: true });
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
161
|
async getConversation(params) {
|
|
@@ -176,7 +176,7 @@ export class ModMailService {
|
|
|
176
176
|
*
|
|
177
177
|
* @example
|
|
178
178
|
* ```ts
|
|
179
|
-
* const subredditsData = await
|
|
179
|
+
* const subredditsData = await modMail().getSubreddits();
|
|
180
180
|
*
|
|
181
181
|
* for (const subreddit of Object.values(subreddits)) {
|
|
182
182
|
* console.log(subreddit.id);
|
|
@@ -215,7 +215,7 @@ export class ModMailService {
|
|
|
215
215
|
*
|
|
216
216
|
* @example
|
|
217
217
|
* ```ts
|
|
218
|
-
* const { conversation, messages, modActions } = await
|
|
218
|
+
* const { conversation, messages, modActions } = await modMail().createConversation({
|
|
219
219
|
* subredditName: 'askReddit',
|
|
220
220
|
* subject: 'Test conversation',
|
|
221
221
|
* body: 'Lorem ipsum sit amet',
|
|
@@ -252,7 +252,7 @@ export class ModMailService {
|
|
|
252
252
|
* @returns A Promise that resolves a string representing the conversationId of the message.
|
|
253
253
|
* @example
|
|
254
254
|
* ```ts
|
|
255
|
-
* const conversationId = await
|
|
255
|
+
* const conversationId = await modMail().createModDiscussionConversation({
|
|
256
256
|
* subject: 'Test conversation',
|
|
257
257
|
* bodyMarkdown: '**Hello there** \n\n _Have a great day!_',
|
|
258
258
|
* subredditId: context.subredditId
|
|
@@ -278,7 +278,7 @@ export class ModMailService {
|
|
|
278
278
|
* @returns A Promise that resolves a string representing the conversationId of the message.
|
|
279
279
|
* @example
|
|
280
280
|
* ```ts
|
|
281
|
-
* const conversationId = await
|
|
281
|
+
* const conversationId = await modMail().createModInboxConversation({
|
|
282
282
|
* subject: 'Test conversation',
|
|
283
283
|
* bodyMarkdown: '**Hello there** \n\n _Have a great day!_',
|
|
284
284
|
* subredditId: context.subredditId
|
|
@@ -305,7 +305,7 @@ export class ModMailService {
|
|
|
305
305
|
* @returns A Promise that resolves a string representing the conversationId of the message.
|
|
306
306
|
* @example
|
|
307
307
|
* ```ts
|
|
308
|
-
* const conversationId = await
|
|
308
|
+
* const conversationId = await modMail().createModNotification({
|
|
309
309
|
* subject: 'Test notification',
|
|
310
310
|
* bodyMarkdown: '**Hello there** \n\n _This is a notification!_',
|
|
311
311
|
* subredditId: context.subredditId
|
|
@@ -336,7 +336,7 @@ export class ModMailService {
|
|
|
336
336
|
*
|
|
337
337
|
* @example
|
|
338
338
|
* ```ts
|
|
339
|
-
* await
|
|
339
|
+
* await modMail().reply({
|
|
340
340
|
* body: 'Lorem ipsum sit amet',
|
|
341
341
|
* conversationId: 'abcdef',
|
|
342
342
|
* });
|
|
@@ -366,7 +366,7 @@ export class ModMailService {
|
|
|
366
366
|
*
|
|
367
367
|
* @example
|
|
368
368
|
* ```ts
|
|
369
|
-
* await
|
|
369
|
+
* await modMail().highlightConversation('abcdef');
|
|
370
370
|
* ```
|
|
371
371
|
*/
|
|
372
372
|
async highlightConversation(conversationId) {
|
|
@@ -389,7 +389,7 @@ export class ModMailService {
|
|
|
389
389
|
*
|
|
390
390
|
* @example
|
|
391
391
|
* ```ts
|
|
392
|
-
* await
|
|
392
|
+
* await modMail().unhighlightConversation('abcdef');
|
|
393
393
|
* ```
|
|
394
394
|
*/
|
|
395
395
|
async unhighlightConversation(conversationId) {
|
|
@@ -412,7 +412,7 @@ export class ModMailService {
|
|
|
412
412
|
*
|
|
413
413
|
* @example
|
|
414
414
|
* ```ts
|
|
415
|
-
* await
|
|
415
|
+
* await modMail().archive('abcdef');
|
|
416
416
|
* ```
|
|
417
417
|
*/
|
|
418
418
|
async archiveConversation(conversationId) {
|
|
@@ -435,7 +435,7 @@ export class ModMailService {
|
|
|
435
435
|
*
|
|
436
436
|
* @example
|
|
437
437
|
* ```ts
|
|
438
|
-
* await
|
|
438
|
+
* await modMail().unarchiveConversation('abcdef');
|
|
439
439
|
* ```
|
|
440
440
|
*/
|
|
441
441
|
async unarchiveConversation(conversationId) {
|
|
@@ -459,7 +459,7 @@ export class ModMailService {
|
|
|
459
459
|
*
|
|
460
460
|
* @example
|
|
461
461
|
* ```ts
|
|
462
|
-
* await
|
|
462
|
+
* await modMail().muteConversation({ conversationId: 'abcdef', numHours: 72 });
|
|
463
463
|
* ```
|
|
464
464
|
*/
|
|
465
465
|
async muteConversation(params) {
|
|
@@ -484,7 +484,7 @@ export class ModMailService {
|
|
|
484
484
|
*
|
|
485
485
|
* @example
|
|
486
486
|
* ```ts
|
|
487
|
-
* await
|
|
487
|
+
* await modMail().unmuteConversation('abcdef');
|
|
488
488
|
* ```
|
|
489
489
|
*/
|
|
490
490
|
async unmuteConversation(conversationId) {
|
|
@@ -508,7 +508,7 @@ export class ModMailService {
|
|
|
508
508
|
*
|
|
509
509
|
* @example
|
|
510
510
|
* ```ts
|
|
511
|
-
* await
|
|
511
|
+
* await modMail().readConversations(['abcdef', 'qwerty']);
|
|
512
512
|
* ```
|
|
513
513
|
*/
|
|
514
514
|
async readConversations(conversationIds) {
|
|
@@ -524,7 +524,7 @@ export class ModMailService {
|
|
|
524
524
|
*
|
|
525
525
|
* @example
|
|
526
526
|
* ```ts
|
|
527
|
-
* await
|
|
527
|
+
* await modMail().unreadConversations(['abcdef', 'qwerty']);
|
|
528
528
|
* ```
|
|
529
529
|
*/
|
|
530
530
|
async unreadConversations(conversationIds) {
|
|
@@ -540,7 +540,7 @@ export class ModMailService {
|
|
|
540
540
|
*
|
|
541
541
|
* @example
|
|
542
542
|
* ```ts
|
|
543
|
-
* await
|
|
543
|
+
* await modMail().approveConversation('abcdef');
|
|
544
544
|
* ```
|
|
545
545
|
*/
|
|
546
546
|
async approveConversation(conversationId) {
|
|
@@ -564,7 +564,7 @@ export class ModMailService {
|
|
|
564
564
|
*
|
|
565
565
|
* @example
|
|
566
566
|
* ```ts
|
|
567
|
-
* await
|
|
567
|
+
* await modMail().disapproveConversation('abcdef');
|
|
568
568
|
* ```
|
|
569
569
|
*/
|
|
570
570
|
async disapproveConversation(conversationId) {
|
|
@@ -589,7 +589,7 @@ export class ModMailService {
|
|
|
589
589
|
*
|
|
590
590
|
* @example
|
|
591
591
|
* ```ts
|
|
592
|
-
* await
|
|
592
|
+
* await modMail().tempBanConversation({ conversationId: 'abcdef', duration: 42 });
|
|
593
593
|
* ```
|
|
594
594
|
*/
|
|
595
595
|
async tempBanConversation(params) {
|
|
@@ -613,7 +613,7 @@ export class ModMailService {
|
|
|
613
613
|
*
|
|
614
614
|
* @example
|
|
615
615
|
* ```ts
|
|
616
|
-
* await
|
|
616
|
+
* await modMail().unbanConversation('abcdef');
|
|
617
617
|
* ```
|
|
618
618
|
*/
|
|
619
619
|
async unbanConversation(conversationId) {
|
|
@@ -635,7 +635,7 @@ export class ModMailService {
|
|
|
635
635
|
*
|
|
636
636
|
* @example
|
|
637
637
|
* ```ts
|
|
638
|
-
* const response = await
|
|
638
|
+
* const response = await modMail().getUnreadCount();
|
|
639
639
|
*
|
|
640
640
|
* console.log(response.highlighted);
|
|
641
641
|
* console.log(response.new);
|
|
@@ -652,7 +652,7 @@ export class ModMailService {
|
|
|
652
652
|
*
|
|
653
653
|
* @example
|
|
654
654
|
* ```ts
|
|
655
|
-
* const data = await
|
|
655
|
+
* const data = await modMail().getUserConversations('abcdef');
|
|
656
656
|
*
|
|
657
657
|
* console.log(data.recentComments);
|
|
658
658
|
* console.log(data.recentPosts);
|
|
@@ -303,7 +303,7 @@ export declare class Post {
|
|
|
303
303
|
* @throws {Error} Throws an error if the suggested sort could not be set.
|
|
304
304
|
* @example
|
|
305
305
|
* ```ts
|
|
306
|
-
* const post = await
|
|
306
|
+
* const post = await getPostById(context.postId);
|
|
307
307
|
* await post.setSuggestedCommentSort("NEW");
|
|
308
308
|
* ```
|
|
309
309
|
*/
|
|
@@ -320,7 +320,7 @@ export declare class Post {
|
|
|
320
320
|
* <text size="large">An updated preview!</text>
|
|
321
321
|
* </vstack>
|
|
322
322
|
* );
|
|
323
|
-
* const post = await
|
|
323
|
+
* const post = await getPostById(context.postId);
|
|
324
324
|
* await post.setCustomPostPreview(() => preview);
|
|
325
325
|
* ```
|
|
326
326
|
*/
|
|
@@ -334,7 +334,7 @@ export declare class Post {
|
|
|
334
334
|
* ```ts
|
|
335
335
|
* // from a menu action, form, scheduler, trigger, custom post click event, etc
|
|
336
336
|
* const newTextFallback = { text: 'This is an updated text fallback' };
|
|
337
|
-
* const post = await
|
|
337
|
+
* const post = await getPostById(context.postId);
|
|
338
338
|
* await post.setTextFallback(newTextFallback);
|
|
339
339
|
* ```
|
|
340
340
|
*/
|
|
@@ -381,7 +381,7 @@ export declare class Post {
|
|
|
381
381
|
* @example
|
|
382
382
|
* ```ts
|
|
383
383
|
* // from a menu action, form, scheduler, trigger, custom post click event, etc
|
|
384
|
-
* const post = await
|
|
384
|
+
* const post = await getPostById(context.postId);
|
|
385
385
|
* const enrichedThumbnail = await post.getEnrichedThumbnail();
|
|
386
386
|
* ```
|
|
387
387
|
*/
|
|
@@ -376,7 +376,7 @@ export class Post {
|
|
|
376
376
|
* @throws {Error} Throws an error if the suggested sort could not be set.
|
|
377
377
|
* @example
|
|
378
378
|
* ```ts
|
|
379
|
-
* const post = await
|
|
379
|
+
* const post = await getPostById(context.postId);
|
|
380
380
|
* await post.setSuggestedCommentSort("NEW");
|
|
381
381
|
* ```
|
|
382
382
|
*/
|
|
@@ -395,7 +395,7 @@ export class Post {
|
|
|
395
395
|
* <text size="large">An updated preview!</text>
|
|
396
396
|
* </vstack>
|
|
397
397
|
* );
|
|
398
|
-
* const post = await
|
|
398
|
+
* const post = await getPostById(context.postId);
|
|
399
399
|
* await post.setCustomPostPreview(() => preview);
|
|
400
400
|
* ```
|
|
401
401
|
*/
|
|
@@ -414,7 +414,7 @@ export class Post {
|
|
|
414
414
|
* ```ts
|
|
415
415
|
* // from a menu action, form, scheduler, trigger, custom post click event, etc
|
|
416
416
|
* const newTextFallback = { text: 'This is an updated text fallback' };
|
|
417
|
-
* const post = await
|
|
417
|
+
* const post = await getPostById(context.postId);
|
|
418
418
|
* await post.setTextFallback(newTextFallback);
|
|
419
419
|
* ```
|
|
420
420
|
*/
|
|
@@ -530,7 +530,7 @@ export class Post {
|
|
|
530
530
|
* @example
|
|
531
531
|
* ```ts
|
|
532
532
|
* // from a menu action, form, scheduler, trigger, custom post click event, etc
|
|
533
|
-
* const post = await
|
|
533
|
+
* const post = await getPostById(context.postId);
|
|
534
534
|
* const enrichedThumbnail = await post.getEnrichedThumbnail();
|
|
535
535
|
* ```
|
|
536
536
|
*/
|
|
@@ -453,7 +453,7 @@ export declare class Subreddit {
|
|
|
453
453
|
* @example
|
|
454
454
|
* ```ts
|
|
455
455
|
* const subredditName = "mysubreddit"
|
|
456
|
-
* const subreddit = await
|
|
456
|
+
* const subreddit = await getSubredditByName(subredditName)
|
|
457
457
|
* const response = await subreddit.getUserFlair();
|
|
458
458
|
* const userFlairList = response.users
|
|
459
459
|
* ```
|
|
@@ -477,7 +477,7 @@ export declare class Subreddit {
|
|
|
477
477
|
*
|
|
478
478
|
* @example
|
|
479
479
|
* ```ts
|
|
480
|
-
* const subreddit = await
|
|
480
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
481
481
|
* let listing = await subreddit.getModQueue();
|
|
482
482
|
* console.log("Posts and Comments: ", await listing.all())
|
|
483
483
|
* listing = await subreddit.getModQueue({ type: "post"});
|
|
@@ -494,7 +494,7 @@ export declare class Subreddit {
|
|
|
494
494
|
*
|
|
495
495
|
* @example
|
|
496
496
|
* ```ts
|
|
497
|
-
* const subreddit = await
|
|
497
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
498
498
|
* let listing = await subreddit.getReports();
|
|
499
499
|
* console.log("Posts and Comments: ", await listing.all())
|
|
500
500
|
* listing = await subreddit.getReports({ type: "post"});
|
|
@@ -511,7 +511,7 @@ export declare class Subreddit {
|
|
|
511
511
|
*
|
|
512
512
|
* @example
|
|
513
513
|
* ```ts
|
|
514
|
-
* const subreddit = await
|
|
514
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
515
515
|
* let listing = await subreddit.getSpam();
|
|
516
516
|
* console.log("Posts and Comments: ", await listing.all())
|
|
517
517
|
* listing = await subreddit.getSpam({ type: "post"});
|
|
@@ -528,7 +528,7 @@ export declare class Subreddit {
|
|
|
528
528
|
*
|
|
529
529
|
* @example
|
|
530
530
|
* ```ts
|
|
531
|
-
* const subreddit = await
|
|
531
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
532
532
|
* let listing = await subreddit.getUnmoderated();
|
|
533
533
|
* console.log("Posts and Comments: ", await listing.all())
|
|
534
534
|
* listing = await subreddit.getUnmoderated({ type: "post"});
|
|
@@ -545,7 +545,7 @@ export declare class Subreddit {
|
|
|
545
545
|
*
|
|
546
546
|
* @example
|
|
547
547
|
* ```ts
|
|
548
|
-
* const subreddit = await
|
|
548
|
+
* const subreddit = await getSubredditByName("mysubreddit")
|
|
549
549
|
* let listing = await subreddit.getEdited();
|
|
550
550
|
* console.log("Posts and Comments: ", await listing.all())
|
|
551
551
|
* listing = await subreddit.getEdited({ type: "post"});
|
|
@@ -561,7 +561,7 @@ export declare class Subreddit {
|
|
|
561
561
|
* @param ids Array of thing full ids (e.g. t3_abc123)
|
|
562
562
|
* @example
|
|
563
563
|
* ```ts
|
|
564
|
-
* const subreddit = await
|
|
564
|
+
* const subreddit = await getSubredditByName('askReddit');
|
|
565
565
|
* const listing = subreddit.getCommentsAndPostsByIds(['t3_abc123', 't1_xyz123']);
|
|
566
566
|
* const items = await listing.all();
|
|
567
567
|
* console.log(items) // [Post, Comment]
|
|
@@ -458,7 +458,7 @@ export class Subreddit {
|
|
|
458
458
|
* @example
|
|
459
459
|
* ```ts
|
|
460
460
|
* const subredditName = "mysubreddit"
|
|
461
|
-
* const subreddit = await
|
|
461
|
+
* const subreddit = await getSubredditByName(subredditName)
|
|
462
462
|
* const response = await subreddit.getUserFlair();
|
|
463
463
|
* const userFlairList = response.users
|
|
464
464
|
* ```
|
|
@@ -564,7 +564,7 @@ export class Subreddit {
|
|
|
564
564
|
* @param ids Array of thing full ids (e.g. t3_abc123)
|
|
565
565
|
* @example
|
|
566
566
|
* ```ts
|
|
567
|
-
* const subreddit = await
|
|
567
|
+
* const subreddit = await getSubredditByName('askReddit');
|
|
568
568
|
* const listing = subreddit.getCommentsAndPostsByIds(['t3_abc123', 't1_xyz123']);
|
|
569
569
|
* const items = await listing.all();
|
|
570
570
|
* console.log(items) // [Post, Comment]
|
|
@@ -193,7 +193,7 @@ export declare class User {
|
|
|
193
193
|
* ```ts
|
|
194
194
|
* const username = "badapple"
|
|
195
195
|
* const subredditName = "mysubreddit"
|
|
196
|
-
* const user = await
|
|
196
|
+
* const user = await getUserByUsername(username);
|
|
197
197
|
* const userFlair = await user.getUserFlairBySubreddit(subredditName);
|
|
198
198
|
* ```
|
|
199
199
|
*/
|
|
@@ -240,7 +240,7 @@ export class User {
|
|
|
240
240
|
* ```ts
|
|
241
241
|
* const username = "badapple"
|
|
242
242
|
* const subredditName = "mysubreddit"
|
|
243
|
-
* const user = await
|
|
243
|
+
* const user = await getUserByUsername(username);
|
|
244
244
|
* const userFlair = await user.getUserFlairBySubreddit(subredditName);
|
|
245
245
|
* ```
|
|
246
246
|
*/
|
package/devvit/Devvit.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export declare class Devvit extends Actor {
|
|
|
106
106
|
* Devvit.addSchedulerJob({
|
|
107
107
|
* name: 'checkNewPosts',
|
|
108
108
|
* onRun: async (event, context) => {
|
|
109
|
-
* const newPosts = await
|
|
109
|
+
* const newPosts = await getNewPosts({ limit: 5 }).all();
|
|
110
110
|
* for (const post of newPosts) {
|
|
111
111
|
* if (post.title.includes('bad word')) {
|
|
112
112
|
* await post.remove();
|
package/devvit/Devvit.js
CHANGED
|
@@ -155,7 +155,7 @@ export class Devvit extends Actor {
|
|
|
155
155
|
* Devvit.addSchedulerJob({
|
|
156
156
|
* name: 'checkNewPosts',
|
|
157
157
|
* onRun: async (event, context) => {
|
|
158
|
-
* const newPosts = await
|
|
158
|
+
* const newPosts = await getNewPosts({ limit: 5 }).all();
|
|
159
159
|
* for (const post of newPosts) {
|
|
160
160
|
* if (post.title.includes('bad word')) {
|
|
161
161
|
* await post.remove();
|