@devvit/protos 0.12.1-next-2025-09-02-23-32-53-b7c54438b.0 → 0.12.1-next-2025-09-03-16-45-14-78942cdf1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/json/devvit/plugin/redditapi/common/common_msg.d.ts +2 -0
  2. package/json/devvit/plugin/redditapi/common/common_msg.d.ts.map +1 -1
  3. package/meta.min.json +6 -6
  4. package/package.json +4 -4
  5. package/protos.min.js +1 -1
  6. package/protos.min.js.map +2 -2
  7. package/schema/.snootobuf/deps/devvit/plugin/redditapi/common/common_msg.proto +3 -0
  8. package/schema/.snootobuf/deps/devvit/plugin/redditapi/subreddits/subreddits_svc.proto +2 -0
  9. package/schema/.snootobuf/output/go-redditapi/flair_svc.generated.go +96 -13
  10. package/schema/.snootobuf/output/go-redditapi/linksandcomments_svc.generated.go +181 -24
  11. package/schema/.snootobuf/output/go-redditapi/listings_svc.generated.go +48 -8
  12. package/schema/.snootobuf/output/go-redditapi/moderation_svc.generated.go +158 -22
  13. package/schema/.snootobuf/output/go-redditapi/modnote_svc.generated.go +34 -5
  14. package/schema/.snootobuf/output/go-redditapi/newmodmail_svc.generated.go +134 -20
  15. package/schema/.snootobuf/output/go-redditapi/privatemessages_svc.generated.go +78 -10
  16. package/schema/.snootobuf/output/go-redditapi/subreddits_svc.generated.go +180 -27
  17. package/schema/.snootobuf/output/go-redditapi/users_svc.generated.go +84 -12
  18. package/schema/.snootobuf/output/go-redditapi/widgets_svc.generated.go +140 -18
  19. package/schema/.snootobuf/output/go-redditapi/wiki_svc.generated.go +70 -10
  20. package/schema/devvit/plugin/redditapi/common/common_msg.proto +3 -0
  21. package/schema/devvit/plugin/redditapi/subreddits/subreddits_svc.proto +2 -0
  22. package/schema/snootobuf.lock +0 -0
  23. package/schema/snootobuf.redditapi.lock +0 -0
  24. package/types/devvit/plugin/redditapi/common/common_msg.d.ts +2 -0
  25. package/types/devvit/plugin/redditapi/common/common_msg.d.ts.map +1 -1
  26. package/types/devvit/plugin/redditapi/common/common_msg.js +15 -0
  27. package/types/devvit/plugin/redditapi/subreddits/subreddits_svc.d.ts +1 -1
  28. package/types/devvit/plugin/redditapi/subreddits/subreddits_svc.d.ts.map +1 -1
  29. package/types/devvit/plugin/redditapi/subreddits/subreddits_svc.js +2 -0
@@ -61,7 +61,12 @@ func (s *RedditHttpPlugin) AboutLog(ctx context.Context, req *redditapi.AboutLog
61
61
  if subredditValidationErr != nil {
62
62
  return nil, subredditValidationErr
63
63
  }
64
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutLog", Path: hydratedPath}, &resp)
64
+ requestConfig := requestConfig{
65
+ Method: "GET",
66
+ ProtoMethod: "AboutLog",
67
+ Path: hydratedPath,
68
+ }
69
+ err := s.doRequest(ctx, requestConfig, &resp)
65
70
  if err != nil {
66
71
  return nil, err
67
72
  }
@@ -108,7 +113,12 @@ func (s *RedditHttpPlugin) AboutLocation(ctx context.Context, req *redditapi.Abo
108
113
  if subredditValidationErr != nil {
109
114
  return nil, subredditValidationErr
110
115
  }
111
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutLocation", Path: hydratedPath}, &resp)
116
+ requestConfig := requestConfig{
117
+ Method: "GET",
118
+ ProtoMethod: "AboutLocation",
119
+ Path: hydratedPath,
120
+ }
121
+ err := s.doRequest(ctx, requestConfig, &resp)
112
122
  if err != nil {
113
123
  return nil, err
114
124
  }
@@ -154,7 +164,12 @@ func (s *RedditHttpPlugin) AboutReports(ctx context.Context, req *redditapi.Abou
154
164
  if subredditValidationErr != nil {
155
165
  return nil, subredditValidationErr
156
166
  }
157
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutReports", Path: hydratedPath}, &resp)
167
+ requestConfig := requestConfig{
168
+ Method: "GET",
169
+ ProtoMethod: "AboutReports",
170
+ Path: hydratedPath,
171
+ }
172
+ err := s.doRequest(ctx, requestConfig, &resp)
158
173
  if err != nil {
159
174
  return nil, err
160
175
  }
@@ -200,7 +215,12 @@ func (s *RedditHttpPlugin) AboutSpam(ctx context.Context, req *redditapi.AboutLo
200
215
  if subredditValidationErr != nil {
201
216
  return nil, subredditValidationErr
202
217
  }
203
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutSpam", Path: hydratedPath}, &resp)
218
+ requestConfig := requestConfig{
219
+ Method: "GET",
220
+ ProtoMethod: "AboutSpam",
221
+ Path: hydratedPath,
222
+ }
223
+ err := s.doRequest(ctx, requestConfig, &resp)
204
224
  if err != nil {
205
225
  return nil, err
206
226
  }
@@ -246,7 +266,12 @@ func (s *RedditHttpPlugin) AboutModqueue(ctx context.Context, req *redditapi.Abo
246
266
  if subredditValidationErr != nil {
247
267
  return nil, subredditValidationErr
248
268
  }
249
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutModqueue", Path: hydratedPath}, &resp)
269
+ requestConfig := requestConfig{
270
+ Method: "GET",
271
+ ProtoMethod: "AboutModqueue",
272
+ Path: hydratedPath,
273
+ }
274
+ err := s.doRequest(ctx, requestConfig, &resp)
250
275
  if err != nil {
251
276
  return nil, err
252
277
  }
@@ -292,7 +317,12 @@ func (s *RedditHttpPlugin) AboutUnmoderated(ctx context.Context, req *redditapi.
292
317
  if subredditValidationErr != nil {
293
318
  return nil, subredditValidationErr
294
319
  }
295
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutUnmoderated", Path: hydratedPath}, &resp)
320
+ requestConfig := requestConfig{
321
+ Method: "GET",
322
+ ProtoMethod: "AboutUnmoderated",
323
+ Path: hydratedPath,
324
+ }
325
+ err := s.doRequest(ctx, requestConfig, &resp)
296
326
  if err != nil {
297
327
  return nil, err
298
328
  }
@@ -338,7 +368,12 @@ func (s *RedditHttpPlugin) AboutEdited(ctx context.Context, req *redditapi.About
338
368
  if subredditValidationErr != nil {
339
369
  return nil, subredditValidationErr
340
370
  }
341
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "AboutEdited", Path: hydratedPath}, &resp)
371
+ requestConfig := requestConfig{
372
+ Method: "GET",
373
+ ProtoMethod: "AboutEdited",
374
+ Path: hydratedPath,
375
+ }
376
+ err := s.doRequest(ctx, requestConfig, &resp)
342
377
  if err != nil {
343
378
  return nil, err
344
379
  }
@@ -354,7 +389,12 @@ func (s *RedditHttpPlugin) AcceptModeratorInvite(ctx context.Context, req *reddi
354
389
  if subredditValidationErr != nil {
355
390
  return nil, subredditValidationErr
356
391
  }
357
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AcceptModeratorInvite", Path: hydratedPath}, &resp)
392
+ requestConfig := requestConfig{
393
+ Method: "POST",
394
+ ProtoMethod: "AcceptModeratorInvite",
395
+ Path: hydratedPath,
396
+ }
397
+ err := s.doRequest(ctx, requestConfig, &resp)
358
398
  if err != nil {
359
399
  return nil, err
360
400
  }
@@ -371,7 +411,14 @@ func (s *RedditHttpPlugin) Approve(ctx context.Context, req *redditapi.BasicMode
371
411
  body := url.Values{}
372
412
  body.Add("id", req.Id)
373
413
  bodyBytes := []byte(body.Encode())
374
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Approve", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
414
+ requestConfig := requestConfig{
415
+ Method: "POST",
416
+ ProtoMethod: "Approve",
417
+ BodyType: FORM_CAMEL,
418
+ Body: bodyBytes,
419
+ Path: hydratedPath,
420
+ }
421
+ err := s.doRequest(ctx, requestConfig, &resp)
375
422
  if err != nil {
376
423
  return nil, err
377
424
  }
@@ -391,7 +438,14 @@ func (s *RedditHttpPlugin) Distinguish(ctx context.Context, req *redditapi.Disti
391
438
  body.Add("id", req.Id)
392
439
  body.Add("sticky", strconv.FormatBool(req.Sticky))
393
440
  bodyBytes := []byte(body.Encode())
394
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Distinguish", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
441
+ requestConfig := requestConfig{
442
+ Method: "POST",
443
+ ProtoMethod: "Distinguish",
444
+ BodyType: FORM_SNAKE,
445
+ Body: bodyBytes,
446
+ Path: hydratedPath,
447
+ }
448
+ err := s.doRequest(ctx, requestConfig, &resp)
395
449
  if err != nil {
396
450
  return nil, err
397
451
  }
@@ -408,7 +462,14 @@ func (s *RedditHttpPlugin) IgnoreReports(ctx context.Context, req *redditapi.Bas
408
462
  body := url.Values{}
409
463
  body.Add("id", req.Id)
410
464
  bodyBytes := []byte(body.Encode())
411
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "IgnoreReports", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
465
+ requestConfig := requestConfig{
466
+ Method: "POST",
467
+ ProtoMethod: "IgnoreReports",
468
+ BodyType: FORM_CAMEL,
469
+ Body: bodyBytes,
470
+ Path: hydratedPath,
471
+ }
472
+ err := s.doRequest(ctx, requestConfig, &resp)
412
473
  if err != nil {
413
474
  return nil, err
414
475
  }
@@ -421,7 +482,14 @@ func (s *RedditHttpPlugin) LeaveContributor(ctx context.Context, req *redditapi.
421
482
  body := url.Values{}
422
483
  body.Add("id", req.Id)
423
484
  bodyBytes := []byte(body.Encode())
424
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "LeaveContributor", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
485
+ requestConfig := requestConfig{
486
+ Method: "POST",
487
+ ProtoMethod: "LeaveContributor",
488
+ BodyType: FORM_CAMEL,
489
+ Body: bodyBytes,
490
+ Path: hydratedPath,
491
+ }
492
+ err := s.doRequest(ctx, requestConfig, &resp)
425
493
  if err != nil {
426
494
  return nil, err
427
495
  }
@@ -434,7 +502,14 @@ func (s *RedditHttpPlugin) LeaveModerator(ctx context.Context, req *redditapi.Ba
434
502
  body := url.Values{}
435
503
  body.Add("id", req.Id)
436
504
  bodyBytes := []byte(body.Encode())
437
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "LeaveModerator", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
505
+ requestConfig := requestConfig{
506
+ Method: "POST",
507
+ ProtoMethod: "LeaveModerator",
508
+ BodyType: FORM_CAMEL,
509
+ Body: bodyBytes,
510
+ Path: hydratedPath,
511
+ }
512
+ err := s.doRequest(ctx, requestConfig, &resp)
438
513
  if err != nil {
439
514
  return nil, err
440
515
  }
@@ -447,7 +522,14 @@ func (s *RedditHttpPlugin) MuteMessageAuthor(ctx context.Context, req *redditapi
447
522
  body := url.Values{}
448
523
  body.Add("id", req.Id)
449
524
  bodyBytes := []byte(body.Encode())
450
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "MuteMessageAuthor", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
525
+ requestConfig := requestConfig{
526
+ Method: "POST",
527
+ ProtoMethod: "MuteMessageAuthor",
528
+ BodyType: FORM_CAMEL,
529
+ Body: bodyBytes,
530
+ Path: hydratedPath,
531
+ }
532
+ err := s.doRequest(ctx, requestConfig, &resp)
451
533
  if err != nil {
452
534
  return nil, err
453
535
  }
@@ -465,7 +547,14 @@ func (s *RedditHttpPlugin) Remove(ctx context.Context, req *redditapi.RemoveRequ
465
547
  body.Add("id", req.Id)
466
548
  body.Add("spam", strconv.FormatBool(req.Spam))
467
549
  bodyBytes := []byte(body.Encode())
468
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Remove", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
550
+ requestConfig := requestConfig{
551
+ Method: "POST",
552
+ ProtoMethod: "Remove",
553
+ BodyType: FORM_CAMEL,
554
+ Body: bodyBytes,
555
+ Path: hydratedPath,
556
+ }
557
+ err := s.doRequest(ctx, requestConfig, &resp)
469
558
  if err != nil {
470
559
  return nil, err
471
560
  }
@@ -482,7 +571,14 @@ func (s *RedditHttpPlugin) ShowComment(ctx context.Context, req *redditapi.Basic
482
571
  body := url.Values{}
483
572
  body.Add("id", req.Id)
484
573
  bodyBytes := []byte(body.Encode())
485
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "ShowComment", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
574
+ requestConfig := requestConfig{
575
+ Method: "POST",
576
+ ProtoMethod: "ShowComment",
577
+ BodyType: FORM_CAMEL,
578
+ Body: bodyBytes,
579
+ Path: hydratedPath,
580
+ }
581
+ err := s.doRequest(ctx, requestConfig, &resp)
486
582
  if err != nil {
487
583
  return nil, err
488
584
  }
@@ -500,7 +596,14 @@ func (s *RedditHttpPlugin) SnoozeReports(ctx context.Context, req *redditapi.Sno
500
596
  body.Add("id", req.Id)
501
597
  body.Add("reason", req.Reason)
502
598
  bodyBytes := []byte(body.Encode())
503
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "SnoozeReports", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
599
+ requestConfig := requestConfig{
600
+ Method: "POST",
601
+ ProtoMethod: "SnoozeReports",
602
+ BodyType: FORM_CAMEL,
603
+ Body: bodyBytes,
604
+ Path: hydratedPath,
605
+ }
606
+ err := s.doRequest(ctx, requestConfig, &resp)
504
607
  if err != nil {
505
608
  return nil, err
506
609
  }
@@ -517,7 +620,14 @@ func (s *RedditHttpPlugin) UnignoreReports(ctx context.Context, req *redditapi.B
517
620
  body := url.Values{}
518
621
  body.Add("id", req.Id)
519
622
  bodyBytes := []byte(body.Encode())
520
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UnignoreReports", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
623
+ requestConfig := requestConfig{
624
+ Method: "POST",
625
+ ProtoMethod: "UnignoreReports",
626
+ BodyType: FORM_CAMEL,
627
+ Body: bodyBytes,
628
+ Path: hydratedPath,
629
+ }
630
+ err := s.doRequest(ctx, requestConfig, &resp)
521
631
  if err != nil {
522
632
  return nil, err
523
633
  }
@@ -530,7 +640,14 @@ func (s *RedditHttpPlugin) UnmuteMessageAuthor(ctx context.Context, req *reddita
530
640
  body := url.Values{}
531
641
  body.Add("id", req.Id)
532
642
  bodyBytes := []byte(body.Encode())
533
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UnmuteMessageAuthor", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
643
+ requestConfig := requestConfig{
644
+ Method: "POST",
645
+ ProtoMethod: "UnmuteMessageAuthor",
646
+ BodyType: FORM_CAMEL,
647
+ Body: bodyBytes,
648
+ Path: hydratedPath,
649
+ }
650
+ err := s.doRequest(ctx, requestConfig, &resp)
534
651
  if err != nil {
535
652
  return nil, err
536
653
  }
@@ -548,7 +665,14 @@ func (s *RedditHttpPlugin) UnsnoozeReports(ctx context.Context, req *redditapi.S
548
665
  body.Add("id", req.Id)
549
666
  body.Add("reason", req.Reason)
550
667
  bodyBytes := []byte(body.Encode())
551
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UnsnoozeReports", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
668
+ requestConfig := requestConfig{
669
+ Method: "POST",
670
+ ProtoMethod: "UnsnoozeReports",
671
+ BodyType: FORM_CAMEL,
672
+ Body: bodyBytes,
673
+ Path: hydratedPath,
674
+ }
675
+ err := s.doRequest(ctx, requestConfig, &resp)
552
676
  if err != nil {
553
677
  return nil, err
554
678
  }
@@ -566,7 +690,14 @@ func (s *RedditHttpPlugin) UpdateCrowdControlLevel(ctx context.Context, req *red
566
690
  body.Add("id", req.Id)
567
691
  body.Add("level", strconv.Itoa(int(req.Level)))
568
692
  bodyBytes := []byte(body.Encode())
569
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UpdateCrowdControlLevel", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
693
+ requestConfig := requestConfig{
694
+ Method: "POST",
695
+ ProtoMethod: "UpdateCrowdControlLevel",
696
+ BodyType: FORM_CAMEL,
697
+ Body: bodyBytes,
698
+ Path: hydratedPath,
699
+ }
700
+ err := s.doRequest(ctx, requestConfig, &resp)
570
701
  if err != nil {
571
702
  return nil, err
572
703
  }
@@ -577,7 +708,12 @@ func (s *RedditHttpPlugin) Stylesheet(ctx context.Context, req *redditapi.Styles
577
708
  hydratedPath := fmt.Sprintf(
578
709
  "/r/%v/stylesheet?raw_json=1",
579
710
  req.Subreddit)
580
- respBody, err := s.doRequestRaw(ctx, requestConfig{Method: "GET", ProtoMethod: "Stylesheet", Path: hydratedPath})
711
+ requestConfig := requestConfig{
712
+ Method: "GET",
713
+ ProtoMethod: "Stylesheet",
714
+ Path: hydratedPath,
715
+ }
716
+ respBody, err := s.doRequestRaw(ctx, requestConfig)
581
717
  if err != nil {
582
718
  return nil, err
583
719
  }
@@ -32,7 +32,12 @@ func (s *RedditHttpPlugin) GetNotes(ctx context.Context, req *redditapi.GetNotes
32
32
  tmpLimitValue,
33
33
  req.Subreddit,
34
34
  req.User)
35
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetNotes", Path: hydratedPath}, &resp)
35
+ requestConfig := requestConfig{
36
+ Method: "GET",
37
+ ProtoMethod: "GetNotes",
38
+ Path: hydratedPath,
39
+ }
40
+ err := s.doRequest(ctx, requestConfig, &resp)
36
41
  if err != nil {
37
42
  return nil, err
38
43
  }
@@ -46,7 +51,12 @@ func (s *RedditHttpPlugin) DeleteNotes(ctx context.Context, req *redditapi.Delet
46
51
  req.NoteId,
47
52
  req.Subreddit,
48
53
  req.User)
49
- err := s.doRequest(ctx, requestConfig{Method: "DELETE", ProtoMethod: "DeleteNotes", Path: hydratedPath}, &resp)
54
+ requestConfig := requestConfig{
55
+ Method: "DELETE",
56
+ ProtoMethod: "DeleteNotes",
57
+ Path: hydratedPath,
58
+ }
59
+ err := s.doRequest(ctx, requestConfig, &resp)
50
60
  if err != nil {
51
61
  return nil, err
52
62
  }
@@ -67,7 +77,14 @@ func (s *RedditHttpPlugin) PostNotes(ctx context.Context, req *redditapi.PostNot
67
77
  body.Add("subreddit", req.Subreddit)
68
78
  body.Add("user", req.User)
69
79
  bodyBytes := []byte(body.Encode())
70
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "PostNotes", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
80
+ requestConfig := requestConfig{
81
+ Method: "POST",
82
+ ProtoMethod: "PostNotes",
83
+ BodyType: FORM_SNAKE,
84
+ Body: bodyBytes,
85
+ Path: hydratedPath,
86
+ }
87
+ err := s.doRequest(ctx, requestConfig, &resp)
71
88
  if err != nil {
72
89
  return nil, err
73
90
  }
@@ -84,7 +101,14 @@ func (s *RedditHttpPlugin) PostRemovalNote(ctx context.Context, req *redditapi.P
84
101
  }
85
102
  body["reason_id"] = req.ReasonId
86
103
  bodyBytes, _ := json.Marshal(body)
87
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "PostRemovalNote", BodyType: JSON_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
104
+ requestConfig := requestConfig{
105
+ Method: "POST",
106
+ ProtoMethod: "PostRemovalNote",
107
+ BodyType: JSON_SNAKE,
108
+ Body: bodyBytes,
109
+ Path: hydratedPath,
110
+ }
111
+ err := s.doRequest(ctx, requestConfig, &resp)
88
112
  if err != nil {
89
113
  return nil, err
90
114
  }
@@ -97,7 +121,12 @@ func (s *RedditHttpPlugin) RecentNotes(ctx context.Context, req *redditapi.Recen
97
121
  "/api/mod/notes/recent?subreddits=%v&users=%v&raw_json=1",
98
122
  req.Subreddits,
99
123
  req.Users)
100
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "RecentNotes", Path: hydratedPath}, &resp)
124
+ requestConfig := requestConfig{
125
+ Method: "GET",
126
+ ProtoMethod: "RecentNotes",
127
+ Path: hydratedPath,
128
+ }
129
+ err := s.doRequest(ctx, requestConfig, &resp)
101
130
  if err != nil {
102
131
  return nil, err
103
132
  }
@@ -20,7 +20,14 @@ func (s *RedditHttpPlugin) BulkReadConversations(ctx context.Context, req *reddi
20
20
  body.Add("entity", req.Entity)
21
21
  body.Add("state", req.State)
22
22
  bodyBytes := []byte(body.Encode())
23
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "BulkReadConversations", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
23
+ requestConfig := requestConfig{
24
+ Method: "POST",
25
+ ProtoMethod: "BulkReadConversations",
26
+ BodyType: FORM_CAMEL,
27
+ Body: bodyBytes,
28
+ Path: hydratedPath,
29
+ }
30
+ err := s.doRequest(ctx, requestConfig, &resp)
24
31
  if err != nil {
25
32
  return nil, err
26
33
  }
@@ -55,7 +62,12 @@ func (s *RedditHttpPlugin) GetConversations(ctx context.Context, req *redditapi.
55
62
  tmpLimitValue,
56
63
  tmpSortValue,
57
64
  tmpStateValue)
58
- respBody, err := s.doRequestRaw(ctx, requestConfig{Method: "GET", ProtoMethod: "GetConversations", Path: hydratedPath})
65
+ requestConfig := requestConfig{
66
+ Method: "GET",
67
+ ProtoMethod: "GetConversations",
68
+ Path: hydratedPath,
69
+ }
70
+ respBody, err := s.doRequestRaw(ctx, requestConfig)
59
71
  if err != nil {
60
72
  return nil, err
61
73
  }
@@ -81,7 +93,14 @@ func (s *RedditHttpPlugin) CreateConversation(ctx context.Context, req *redditap
81
93
  body.Add("to", req.To.GetValue())
82
94
  }
83
95
  bodyBytes := []byte(body.Encode())
84
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "CreateConversation", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
96
+ requestConfig := requestConfig{
97
+ Method: "POST",
98
+ ProtoMethod: "CreateConversation",
99
+ BodyType: FORM_CAMEL,
100
+ Body: bodyBytes,
101
+ Path: hydratedPath,
102
+ }
103
+ err := s.doRequest(ctx, requestConfig, &resp)
85
104
  if err != nil {
86
105
  return nil, err
87
106
  }
@@ -93,7 +112,12 @@ func (s *RedditHttpPlugin) GetConversation(ctx context.Context, req *redditapi.G
93
112
  "/api/mod/conversations/%v?markRead=%v&raw_json=1",
94
113
  req.ConversationId,
95
114
  req.MarkRead)
96
- respBody, err := s.doRequestRaw(ctx, requestConfig{Method: "GET", ProtoMethod: "GetConversation", Path: hydratedPath})
115
+ requestConfig := requestConfig{
116
+ Method: "GET",
117
+ ProtoMethod: "GetConversation",
118
+ Path: hydratedPath,
119
+ }
120
+ respBody, err := s.doRequestRaw(ctx, requestConfig)
97
121
  if err != nil {
98
122
  return nil, err
99
123
  }
@@ -118,7 +142,14 @@ func (s *RedditHttpPlugin) CreateConversationMessage(ctx context.Context, req *r
118
142
  body.Add("isAuthorHidden", strconv.FormatBool(req.IsAuthorHidden))
119
143
  body.Add("isInternal", strconv.FormatBool(req.IsInternal))
120
144
  bodyBytes := []byte(body.Encode())
121
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "CreateConversationMessage", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
145
+ requestConfig := requestConfig{
146
+ Method: "POST",
147
+ ProtoMethod: "CreateConversationMessage",
148
+ BodyType: FORM_CAMEL,
149
+ Body: bodyBytes,
150
+ Path: hydratedPath,
151
+ }
152
+ err := s.doRequest(ctx, requestConfig, &resp)
122
153
  if err != nil {
123
154
  return nil, err
124
155
  }
@@ -130,7 +161,12 @@ func (s *RedditHttpPlugin) ApproveConversation(ctx context.Context, req *reddita
130
161
  hydratedPath := fmt.Sprintf(
131
162
  "/api/mod/conversations/%v/approve?raw_json=1",
132
163
  req.ConversationId)
133
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "ApproveConversation", Path: hydratedPath}, &resp)
164
+ requestConfig := requestConfig{
165
+ Method: "POST",
166
+ ProtoMethod: "ApproveConversation",
167
+ Path: hydratedPath,
168
+ }
169
+ err := s.doRequest(ctx, requestConfig, &resp)
134
170
  if err != nil {
135
171
  return nil, err
136
172
  }
@@ -142,7 +178,12 @@ func (s *RedditHttpPlugin) ArchiveConversation(ctx context.Context, req *reddita
142
178
  hydratedPath := fmt.Sprintf(
143
179
  "/api/mod/conversations/%v/archive?raw_json=1",
144
180
  req.ConversationId)
145
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "ArchiveConversation", Path: hydratedPath}, &resp)
181
+ requestConfig := requestConfig{
182
+ Method: "POST",
183
+ ProtoMethod: "ArchiveConversation",
184
+ Path: hydratedPath,
185
+ }
186
+ err := s.doRequest(ctx, requestConfig, &resp)
146
187
  if err != nil {
147
188
  return nil, err
148
189
  }
@@ -154,7 +195,12 @@ func (s *RedditHttpPlugin) DisapproveConversation(ctx context.Context, req *redd
154
195
  hydratedPath := fmt.Sprintf(
155
196
  "/api/mod/conversations/%v/disapprove?raw_json=1",
156
197
  req.ConversationId)
157
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "DisapproveConversation", Path: hydratedPath}, &resp)
198
+ requestConfig := requestConfig{
199
+ Method: "POST",
200
+ ProtoMethod: "DisapproveConversation",
201
+ Path: hydratedPath,
202
+ }
203
+ err := s.doRequest(ctx, requestConfig, &resp)
158
204
  if err != nil {
159
205
  return nil, err
160
206
  }
@@ -166,7 +212,12 @@ func (s *RedditHttpPlugin) UnhighlightConversation(ctx context.Context, req *red
166
212
  hydratedPath := fmt.Sprintf(
167
213
  "/api/mod/conversations/%v/highlight?raw_json=1",
168
214
  req.ConversationId)
169
- err := s.doRequest(ctx, requestConfig{Method: "DELETE", ProtoMethod: "UnhighlightConversation", Path: hydratedPath}, &resp)
215
+ requestConfig := requestConfig{
216
+ Method: "DELETE",
217
+ ProtoMethod: "UnhighlightConversation",
218
+ Path: hydratedPath,
219
+ }
220
+ err := s.doRequest(ctx, requestConfig, &resp)
170
221
  if err != nil {
171
222
  return nil, err
172
223
  }
@@ -178,7 +229,12 @@ func (s *RedditHttpPlugin) HighlightConversation(ctx context.Context, req *reddi
178
229
  hydratedPath := fmt.Sprintf(
179
230
  "/api/mod/conversations/%v/highlight?raw_json=1",
180
231
  req.ConversationId)
181
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "HighlightConversation", Path: hydratedPath}, &resp)
232
+ requestConfig := requestConfig{
233
+ Method: "POST",
234
+ ProtoMethod: "HighlightConversation",
235
+ Path: hydratedPath,
236
+ }
237
+ err := s.doRequest(ctx, requestConfig, &resp)
182
238
  if err != nil {
183
239
  return nil, err
184
240
  }
@@ -194,7 +250,14 @@ func (s *RedditHttpPlugin) MuteConversation(ctx context.Context, req *redditapi.
194
250
  body.Add("conversation_id", req.ConversationId)
195
251
  body.Add("num_hours", strconv.Itoa(int(req.NumHours)))
196
252
  bodyBytes := []byte(body.Encode())
197
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "MuteConversation", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
253
+ requestConfig := requestConfig{
254
+ Method: "POST",
255
+ ProtoMethod: "MuteConversation",
256
+ BodyType: FORM_SNAKE,
257
+ Body: bodyBytes,
258
+ Path: hydratedPath,
259
+ }
260
+ err := s.doRequest(ctx, requestConfig, &resp)
198
261
  if err != nil {
199
262
  return nil, err
200
263
  }
@@ -210,7 +273,14 @@ func (s *RedditHttpPlugin) TempBan(ctx context.Context, req *redditapi.TempBanRe
210
273
  body["conversationId"] = req.ConversationId
211
274
  body["duration"] = req.Duration
212
275
  bodyBytes, _ := json.Marshal(body)
213
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "TempBan", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
276
+ requestConfig := requestConfig{
277
+ Method: "POST",
278
+ ProtoMethod: "TempBan",
279
+ BodyType: JSON_CAMEL,
280
+ Body: bodyBytes,
281
+ Path: hydratedPath,
282
+ }
283
+ err := s.doRequest(ctx, requestConfig, &resp)
214
284
  if err != nil {
215
285
  return nil, err
216
286
  }
@@ -222,7 +292,12 @@ func (s *RedditHttpPlugin) UnarchiveConversation(ctx context.Context, req *reddi
222
292
  hydratedPath := fmt.Sprintf(
223
293
  "/api/mod/conversations/%v/unarchive?raw_json=1",
224
294
  req.ConversationId)
225
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UnarchiveConversation", Path: hydratedPath}, &resp)
295
+ requestConfig := requestConfig{
296
+ Method: "POST",
297
+ ProtoMethod: "UnarchiveConversation",
298
+ Path: hydratedPath,
299
+ }
300
+ err := s.doRequest(ctx, requestConfig, &resp)
226
301
  if err != nil {
227
302
  return nil, err
228
303
  }
@@ -234,7 +309,12 @@ func (s *RedditHttpPlugin) Unban(ctx context.Context, req *redditapi.BasicConver
234
309
  hydratedPath := fmt.Sprintf(
235
310
  "/api/mod/conversations/%v/unban?raw_json=1",
236
311
  req.ConversationId)
237
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Unban", Path: hydratedPath}, &resp)
312
+ requestConfig := requestConfig{
313
+ Method: "POST",
314
+ ProtoMethod: "Unban",
315
+ Path: hydratedPath,
316
+ }
317
+ err := s.doRequest(ctx, requestConfig, &resp)
238
318
  if err != nil {
239
319
  return nil, err
240
320
  }
@@ -246,7 +326,12 @@ func (s *RedditHttpPlugin) UnmuteConversation(ctx context.Context, req *redditap
246
326
  hydratedPath := fmt.Sprintf(
247
327
  "/api/mod/conversations/%v/unmute?raw_json=1",
248
328
  req.ConversationId)
249
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UnmuteConversation", Path: hydratedPath}, &resp)
329
+ requestConfig := requestConfig{
330
+ Method: "POST",
331
+ ProtoMethod: "UnmuteConversation",
332
+ Path: hydratedPath,
333
+ }
334
+ err := s.doRequest(ctx, requestConfig, &resp)
250
335
  if err != nil {
251
336
  return nil, err
252
337
  }
@@ -258,7 +343,12 @@ func (s *RedditHttpPlugin) UserConversations(ctx context.Context, req *redditapi
258
343
  hydratedPath := fmt.Sprintf(
259
344
  "/api/mod/conversations/%v/user?raw_json=1",
260
345
  req.ConversationId)
261
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "UserConversations", Path: hydratedPath}, &resp)
346
+ requestConfig := requestConfig{
347
+ Method: "GET",
348
+ ProtoMethod: "UserConversations",
349
+ Path: hydratedPath,
350
+ }
351
+ err := s.doRequest(ctx, requestConfig, &resp)
262
352
  if err != nil {
263
353
  return nil, err
264
354
  }
@@ -271,7 +361,14 @@ func (s *RedditHttpPlugin) Read(ctx context.Context, req *redditapi.BasicConvers
271
361
  body := url.Values{}
272
362
  body.Add("conversationIds", req.ConversationIds)
273
363
  bodyBytes := []byte(body.Encode())
274
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Read", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
364
+ requestConfig := requestConfig{
365
+ Method: "POST",
366
+ ProtoMethod: "Read",
367
+ BodyType: FORM_CAMEL,
368
+ Body: bodyBytes,
369
+ Path: hydratedPath,
370
+ }
371
+ err := s.doRequest(ctx, requestConfig, &resp)
275
372
  if err != nil {
276
373
  return nil, err
277
374
  }
@@ -281,7 +378,12 @@ func (s *RedditHttpPlugin) Read(ctx context.Context, req *redditapi.BasicConvers
281
378
  func (s *RedditHttpPlugin) Subreddits(ctx context.Context, req *emptypb.Empty) (*redditapi.SubredditsResponse, error) {
282
379
  resp := redditapi.SubredditsResponse{}
283
380
  hydratedPath := `/api/mod/conversations/subreddits?raw_json=1`
284
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "Subreddits", Path: hydratedPath}, &resp)
381
+ requestConfig := requestConfig{
382
+ Method: "GET",
383
+ ProtoMethod: "Subreddits",
384
+ Path: hydratedPath,
385
+ }
386
+ err := s.doRequest(ctx, requestConfig, &resp)
285
387
  if err != nil {
286
388
  return nil, err
287
389
  }
@@ -294,7 +396,14 @@ func (s *RedditHttpPlugin) Unread(ctx context.Context, req *redditapi.BasicConve
294
396
  body := url.Values{}
295
397
  body.Add("conversationIds", req.ConversationIds)
296
398
  bodyBytes := []byte(body.Encode())
297
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Unread", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
399
+ requestConfig := requestConfig{
400
+ Method: "POST",
401
+ ProtoMethod: "Unread",
402
+ BodyType: FORM_CAMEL,
403
+ Body: bodyBytes,
404
+ Path: hydratedPath,
405
+ }
406
+ err := s.doRequest(ctx, requestConfig, &resp)
298
407
  if err != nil {
299
408
  return nil, err
300
409
  }
@@ -304,7 +413,12 @@ func (s *RedditHttpPlugin) Unread(ctx context.Context, req *redditapi.BasicConve
304
413
  func (s *RedditHttpPlugin) UnreadCount(ctx context.Context, req *emptypb.Empty) (*redditapi.UnreadCountResponse, error) {
305
414
  resp := redditapi.UnreadCountResponse{}
306
415
  hydratedPath := `/api/mod/conversations/unread/count?raw_json=1`
307
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "UnreadCount", Path: hydratedPath}, &resp)
416
+ requestConfig := requestConfig{
417
+ Method: "GET",
418
+ ProtoMethod: "UnreadCount",
419
+ Path: hydratedPath,
420
+ }
421
+ err := s.doRequest(ctx, requestConfig, &resp)
308
422
  if err != nil {
309
423
  return nil, err
310
424
  }