@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
@@ -26,7 +26,14 @@ func (s *RedditHttpPlugin) BlockUser(ctx context.Context, req *redditapi.BlockUs
26
26
  body.Add("name", req.Name.GetValue())
27
27
  }
28
28
  bodyBytes := []byte(body.Encode())
29
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "BlockUser", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
29
+ requestConfig := requestConfig{
30
+ Method: "POST",
31
+ ProtoMethod: "BlockUser",
32
+ BodyType: FORM_SNAKE,
33
+ Body: bodyBytes,
34
+ Path: hydratedPath,
35
+ }
36
+ err := s.doRequest(ctx, requestConfig, &resp)
30
37
  if err != nil {
31
38
  return nil, err
32
39
  }
@@ -68,7 +75,14 @@ func (s *RedditHttpPlugin) Friend(ctx context.Context, req *redditapi.FriendRequ
68
75
  }
69
76
  body.Add("type", req.Type)
70
77
  bodyBytes := []byte(body.Encode())
71
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Friend", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
78
+ requestConfig := requestConfig{
79
+ Method: "POST",
80
+ ProtoMethod: "Friend",
81
+ BodyType: FORM_SNAKE,
82
+ Body: bodyBytes,
83
+ Path: hydratedPath,
84
+ }
85
+ err := s.doRequest(ctx, requestConfig, &resp)
72
86
  if err != nil {
73
87
  return nil, err
74
88
  }
@@ -83,7 +97,14 @@ func (s *RedditHttpPlugin) ReportUser(ctx context.Context, req *redditapi.Report
83
97
  body.Add("reason", req.Reason)
84
98
  body.Add("user", req.User)
85
99
  bodyBytes := []byte(body.Encode())
86
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "ReportUser", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
100
+ requestConfig := requestConfig{
101
+ Method: "POST",
102
+ ProtoMethod: "ReportUser",
103
+ BodyType: FORM_SNAKE,
104
+ Body: bodyBytes,
105
+ Path: hydratedPath,
106
+ }
107
+ err := s.doRequest(ctx, requestConfig, &resp)
87
108
  if err != nil {
88
109
  return nil, err
89
110
  }
@@ -102,7 +123,14 @@ func (s *RedditHttpPlugin) SetPermissions(ctx context.Context, req *redditapi.Se
102
123
  body.Add("subreddit", req.Subreddit)
103
124
  body.Add("type", req.Type)
104
125
  bodyBytes := []byte(body.Encode())
105
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "SetPermissions", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
126
+ requestConfig := requestConfig{
127
+ Method: "POST",
128
+ ProtoMethod: "SetPermissions",
129
+ BodyType: FORM_SNAKE,
130
+ Body: bodyBytes,
131
+ Path: hydratedPath,
132
+ }
133
+ err := s.doRequest(ctx, requestConfig, &resp)
106
134
  if err != nil {
107
135
  return nil, err
108
136
  }
@@ -130,7 +158,14 @@ func (s *RedditHttpPlugin) Unfriend(ctx context.Context, req *redditapi.Unfriend
130
158
  }
131
159
  body.Add("type", req.Type)
132
160
  bodyBytes := []byte(body.Encode())
133
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "Unfriend", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
161
+ requestConfig := requestConfig{
162
+ Method: "POST",
163
+ ProtoMethod: "Unfriend",
164
+ BodyType: FORM_SNAKE,
165
+ Body: bodyBytes,
166
+ Path: hydratedPath,
167
+ }
168
+ err := s.doRequest(ctx, requestConfig, &resp)
134
169
  if err != nil {
135
170
  return nil, err
136
171
  }
@@ -141,7 +176,12 @@ func (s *RedditHttpPlugin) UsernameAvailable(ctx context.Context, req *redditapi
141
176
  hydratedPath := fmt.Sprintf(
142
177
  "/api/username_available?user=%v&raw_json=1",
143
178
  req.User)
144
- respBody, err := s.doRequestRaw(ctx, requestConfig{Method: "GET", ProtoMethod: "UsernameAvailable", Path: hydratedPath})
179
+ requestConfig := requestConfig{
180
+ Method: "GET",
181
+ ProtoMethod: "UsernameAvailable",
182
+ Path: hydratedPath,
183
+ }
184
+ respBody, err := s.doRequestRaw(ctx, requestConfig)
145
185
  if err != nil {
146
186
  return nil, err
147
187
  }
@@ -165,7 +205,12 @@ func (s *RedditHttpPlugin) UnfriendUser(ctx context.Context, req *redditapi.Gene
165
205
  "/api/v1/me/friends/%v?id=%v&raw_json=1",
166
206
  req.Username,
167
207
  tmpIdValue)
168
- err := s.doRequest(ctx, requestConfig{Method: "DELETE", ProtoMethod: "UnfriendUser", Path: hydratedPath}, &resp)
208
+ requestConfig := requestConfig{
209
+ Method: "DELETE",
210
+ ProtoMethod: "UnfriendUser",
211
+ Path: hydratedPath,
212
+ }
213
+ err := s.doRequest(ctx, requestConfig, &resp)
169
214
  if err != nil {
170
215
  return nil, err
171
216
  }
@@ -182,7 +227,12 @@ func (s *RedditHttpPlugin) GetFriendInformation(ctx context.Context, req *reddit
182
227
  "/api/v1/me/friends/%v?id=%v&raw_json=1",
183
228
  req.Username,
184
229
  tmpIdValue)
185
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetFriendInformation", Path: hydratedPath}, &resp)
230
+ requestConfig := requestConfig{
231
+ Method: "GET",
232
+ ProtoMethod: "GetFriendInformation",
233
+ Path: hydratedPath,
234
+ }
235
+ err := s.doRequest(ctx, requestConfig, &resp)
186
236
  if err != nil {
187
237
  return nil, err
188
238
  }
@@ -198,7 +248,14 @@ func (s *RedditHttpPlugin) UpdateFriendRelationship(ctx context.Context, req *re
198
248
  body["name"] = req.Name
199
249
  body["note"] = req.Note
200
250
  bodyBytes, _ := json.Marshal(body)
201
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateFriendRelationship", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
251
+ requestConfig := requestConfig{
252
+ Method: "PUT",
253
+ ProtoMethod: "UpdateFriendRelationship",
254
+ BodyType: JSON_CAMEL,
255
+ Body: bodyBytes,
256
+ Path: hydratedPath,
257
+ }
258
+ err := s.doRequest(ctx, requestConfig, &resp)
202
259
  if err != nil {
203
260
  return nil, err
204
261
  }
@@ -215,7 +272,12 @@ func (s *RedditHttpPlugin) UserTrophies(ctx context.Context, req *redditapi.Gene
215
272
  "/api/v1/user/%v/trophies?id=%v&raw_json=1",
216
273
  req.Username,
217
274
  tmpIdValue)
218
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "UserTrophies", Path: hydratedPath}, &resp)
275
+ requestConfig := requestConfig{
276
+ Method: "GET",
277
+ ProtoMethod: "UserTrophies",
278
+ Path: hydratedPath,
279
+ }
280
+ err := s.doRequest(ctx, requestConfig, &resp)
219
281
  if err != nil {
220
282
  return nil, err
221
283
  }
@@ -227,7 +289,12 @@ func (s *RedditHttpPlugin) UserAbout(ctx context.Context, req *redditapi.UserAbo
227
289
  hydratedPath := fmt.Sprintf(
228
290
  "/user/%v/about?raw_json=1",
229
291
  req.Username)
230
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "UserAbout", Path: hydratedPath}, &resp)
292
+ requestConfig := requestConfig{
293
+ Method: "GET",
294
+ ProtoMethod: "UserAbout",
295
+ Path: hydratedPath,
296
+ }
297
+ err := s.doRequest(ctx, requestConfig, &resp)
231
298
  if err != nil {
232
299
  return nil, err
233
300
  }
@@ -289,7 +356,12 @@ func (s *RedditHttpPlugin) UserWhere(ctx context.Context, req *redditapi.UserWhe
289
356
  tmpBeforeValue,
290
357
  tmpCountValue,
291
358
  tmpLimitValue)
292
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "UserWhere", Path: hydratedPath}, &resp)
359
+ requestConfig := requestConfig{
360
+ Method: "GET",
361
+ ProtoMethod: "UserWhere",
362
+ Path: hydratedPath,
363
+ }
364
+ err := s.doRequest(ctx, requestConfig, &resp)
293
365
  if err != nil {
294
366
  return nil, err
295
367
  }
@@ -24,7 +24,14 @@ func (s *RedditHttpPlugin) AddButtonWidget(ctx context.Context, req *redditapi.A
24
24
  body["styles"] = buildMessageJson(req.Styles)
25
25
  body["subreddit"] = req.Subreddit
26
26
  bodyBytes, _ := json.Marshal(body)
27
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddButtonWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
27
+ requestConfig := requestConfig{
28
+ Method: "POST",
29
+ ProtoMethod: "AddButtonWidget",
30
+ BodyType: JSON_CAMEL,
31
+ Body: bodyBytes,
32
+ Path: hydratedPath,
33
+ }
34
+ err := s.doRequest(ctx, requestConfig, &resp)
28
35
  if err != nil {
29
36
  return nil, err
30
37
  }
@@ -43,7 +50,14 @@ func (s *RedditHttpPlugin) AddImageWidget(ctx context.Context, req *redditapi.Ad
43
50
  body["styles"] = buildMessageJson(req.Styles)
44
51
  body["subreddit"] = req.Subreddit
45
52
  bodyBytes, _ := json.Marshal(body)
46
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddImageWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
53
+ requestConfig := requestConfig{
54
+ Method: "POST",
55
+ ProtoMethod: "AddImageWidget",
56
+ BodyType: JSON_CAMEL,
57
+ Body: bodyBytes,
58
+ Path: hydratedPath,
59
+ }
60
+ err := s.doRequest(ctx, requestConfig, &resp)
47
61
  if err != nil {
48
62
  return nil, err
49
63
  }
@@ -64,7 +78,14 @@ func (s *RedditHttpPlugin) AddCalendarWidget(ctx context.Context, req *redditapi
64
78
  body["styles"] = buildMessageJson(req.Styles)
65
79
  body["subreddit"] = req.Subreddit
66
80
  bodyBytes, _ := json.Marshal(body)
67
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddCalendarWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
81
+ requestConfig := requestConfig{
82
+ Method: "POST",
83
+ ProtoMethod: "AddCalendarWidget",
84
+ BodyType: JSON_CAMEL,
85
+ Body: bodyBytes,
86
+ Path: hydratedPath,
87
+ }
88
+ err := s.doRequest(ctx, requestConfig, &resp)
68
89
  if err != nil {
69
90
  return nil, err
70
91
  }
@@ -83,7 +104,14 @@ func (s *RedditHttpPlugin) AddTextAreaWidget(ctx context.Context, req *redditapi
83
104
  body["subreddit"] = req.Subreddit
84
105
  body["text"] = req.Text
85
106
  bodyBytes, _ := json.Marshal(body)
86
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddTextAreaWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
107
+ requestConfig := requestConfig{
108
+ Method: "POST",
109
+ ProtoMethod: "AddTextAreaWidget",
110
+ BodyType: JSON_CAMEL,
111
+ Body: bodyBytes,
112
+ Path: hydratedPath,
113
+ }
114
+ err := s.doRequest(ctx, requestConfig, &resp)
87
115
  if err != nil {
88
116
  return nil, err
89
117
  }
@@ -102,7 +130,14 @@ func (s *RedditHttpPlugin) AddCommunityListWidget(ctx context.Context, req *redd
102
130
  body["styles"] = buildMessageJson(req.Styles)
103
131
  body["subreddit"] = req.Subreddit
104
132
  bodyBytes, _ := json.Marshal(body)
105
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddCommunityListWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
133
+ requestConfig := requestConfig{
134
+ Method: "POST",
135
+ ProtoMethod: "AddCommunityListWidget",
136
+ BodyType: JSON_CAMEL,
137
+ Body: bodyBytes,
138
+ Path: hydratedPath,
139
+ }
140
+ err := s.doRequest(ctx, requestConfig, &resp)
106
141
  if err != nil {
107
142
  return nil, err
108
143
  }
@@ -122,7 +157,14 @@ func (s *RedditHttpPlugin) AddPostFlairWidget(ctx context.Context, req *redditap
122
157
  body["styles"] = buildMessageJson(req.Styles)
123
158
  body["subreddit"] = req.Subreddit
124
159
  bodyBytes, _ := json.Marshal(body)
125
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddPostFlairWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
160
+ requestConfig := requestConfig{
161
+ Method: "POST",
162
+ ProtoMethod: "AddPostFlairWidget",
163
+ BodyType: JSON_CAMEL,
164
+ Body: bodyBytes,
165
+ Path: hydratedPath,
166
+ }
167
+ err := s.doRequest(ctx, requestConfig, &resp)
126
168
  if err != nil {
127
169
  return nil, err
128
170
  }
@@ -144,7 +186,14 @@ func (s *RedditHttpPlugin) AddCustomWidget(ctx context.Context, req *redditapi.A
144
186
  body["subreddit"] = req.Subreddit
145
187
  body["text"] = req.Text
146
188
  bodyBytes, _ := json.Marshal(body)
147
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AddCustomWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
189
+ requestConfig := requestConfig{
190
+ Method: "POST",
191
+ ProtoMethod: "AddCustomWidget",
192
+ BodyType: JSON_CAMEL,
193
+ Body: bodyBytes,
194
+ Path: hydratedPath,
195
+ }
196
+ err := s.doRequest(ctx, requestConfig, &resp)
148
197
  if err != nil {
149
198
  return nil, err
150
199
  }
@@ -157,7 +206,12 @@ func (s *RedditHttpPlugin) DeleteWidget(ctx context.Context, req *redditapi.Dele
157
206
  "/r/%v/api/widget/%v?raw_json=1",
158
207
  req.Subreddit,
159
208
  req.Id)
160
- err := s.doRequest(ctx, requestConfig{Method: "DELETE", ProtoMethod: "DeleteWidget", Path: hydratedPath}, &resp)
209
+ requestConfig := requestConfig{
210
+ Method: "DELETE",
211
+ ProtoMethod: "DeleteWidget",
212
+ Path: hydratedPath,
213
+ }
214
+ err := s.doRequest(ctx, requestConfig, &resp)
161
215
  if err != nil {
162
216
  return nil, err
163
217
  }
@@ -179,7 +233,14 @@ func (s *RedditHttpPlugin) UpdateButtonWidget(ctx context.Context, req *redditap
179
233
  body["styles"] = buildMessageJson(req.Styles)
180
234
  body["subreddit"] = req.Subreddit
181
235
  bodyBytes, _ := json.Marshal(body)
182
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateButtonWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
236
+ requestConfig := requestConfig{
237
+ Method: "PUT",
238
+ ProtoMethod: "UpdateButtonWidget",
239
+ BodyType: JSON_CAMEL,
240
+ Body: bodyBytes,
241
+ Path: hydratedPath,
242
+ }
243
+ err := s.doRequest(ctx, requestConfig, &resp)
183
244
  if err != nil {
184
245
  return nil, err
185
246
  }
@@ -200,7 +261,14 @@ func (s *RedditHttpPlugin) UpdateImageWidget(ctx context.Context, req *redditapi
200
261
  body["styles"] = buildMessageJson(req.Styles)
201
262
  body["subreddit"] = req.Subreddit
202
263
  bodyBytes, _ := json.Marshal(body)
203
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateImageWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
264
+ requestConfig := requestConfig{
265
+ Method: "PUT",
266
+ ProtoMethod: "UpdateImageWidget",
267
+ BodyType: JSON_CAMEL,
268
+ Body: bodyBytes,
269
+ Path: hydratedPath,
270
+ }
271
+ err := s.doRequest(ctx, requestConfig, &resp)
204
272
  if err != nil {
205
273
  return nil, err
206
274
  }
@@ -223,7 +291,14 @@ func (s *RedditHttpPlugin) UpdateCalendarWidget(ctx context.Context, req *reddit
223
291
  body["styles"] = buildMessageJson(req.Styles)
224
292
  body["subreddit"] = req.Subreddit
225
293
  bodyBytes, _ := json.Marshal(body)
226
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateCalendarWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
294
+ requestConfig := requestConfig{
295
+ Method: "PUT",
296
+ ProtoMethod: "UpdateCalendarWidget",
297
+ BodyType: JSON_CAMEL,
298
+ Body: bodyBytes,
299
+ Path: hydratedPath,
300
+ }
301
+ err := s.doRequest(ctx, requestConfig, &resp)
227
302
  if err != nil {
228
303
  return nil, err
229
304
  }
@@ -244,7 +319,14 @@ func (s *RedditHttpPlugin) UpdateTextAreaWidget(ctx context.Context, req *reddit
244
319
  body["subreddit"] = req.Subreddit
245
320
  body["text"] = req.Text
246
321
  bodyBytes, _ := json.Marshal(body)
247
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateTextAreaWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
322
+ requestConfig := requestConfig{
323
+ Method: "PUT",
324
+ ProtoMethod: "UpdateTextAreaWidget",
325
+ BodyType: JSON_CAMEL,
326
+ Body: bodyBytes,
327
+ Path: hydratedPath,
328
+ }
329
+ err := s.doRequest(ctx, requestConfig, &resp)
248
330
  if err != nil {
249
331
  return nil, err
250
332
  }
@@ -265,7 +347,14 @@ func (s *RedditHttpPlugin) UpdateCommunityListWidget(ctx context.Context, req *r
265
347
  body["styles"] = buildMessageJson(req.Styles)
266
348
  body["subreddit"] = req.Subreddit
267
349
  bodyBytes, _ := json.Marshal(body)
268
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateCommunityListWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
350
+ requestConfig := requestConfig{
351
+ Method: "PUT",
352
+ ProtoMethod: "UpdateCommunityListWidget",
353
+ BodyType: JSON_CAMEL,
354
+ Body: bodyBytes,
355
+ Path: hydratedPath,
356
+ }
357
+ err := s.doRequest(ctx, requestConfig, &resp)
269
358
  if err != nil {
270
359
  return nil, err
271
360
  }
@@ -287,7 +376,14 @@ func (s *RedditHttpPlugin) UpdatePostFlairWidget(ctx context.Context, req *reddi
287
376
  body["styles"] = buildMessageJson(req.Styles)
288
377
  body["subreddit"] = req.Subreddit
289
378
  bodyBytes, _ := json.Marshal(body)
290
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdatePostFlairWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
379
+ requestConfig := requestConfig{
380
+ Method: "PUT",
381
+ ProtoMethod: "UpdatePostFlairWidget",
382
+ BodyType: JSON_CAMEL,
383
+ Body: bodyBytes,
384
+ Path: hydratedPath,
385
+ }
386
+ err := s.doRequest(ctx, requestConfig, &resp)
291
387
  if err != nil {
292
388
  return nil, err
293
389
  }
@@ -311,7 +407,14 @@ func (s *RedditHttpPlugin) UpdateCustomWidget(ctx context.Context, req *redditap
311
407
  body["subreddit"] = req.Subreddit
312
408
  body["text"] = req.Text
313
409
  bodyBytes, _ := json.Marshal(body)
314
- err := s.doRequest(ctx, requestConfig{Method: "PUT", ProtoMethod: "UpdateCustomWidget", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
410
+ requestConfig := requestConfig{
411
+ Method: "PUT",
412
+ ProtoMethod: "UpdateCustomWidget",
413
+ BodyType: JSON_CAMEL,
414
+ Body: bodyBytes,
415
+ Path: hydratedPath,
416
+ }
417
+ err := s.doRequest(ctx, requestConfig, &resp)
315
418
  if err != nil {
316
419
  return nil, err
317
420
  }
@@ -328,7 +431,14 @@ func (s *RedditHttpPlugin) GetWidgetImageUploadLease(ctx context.Context, req *r
328
431
  body.Add("mimetype", req.Mimetype)
329
432
  body.Add("subreddit", req.Subreddit)
330
433
  bodyBytes := []byte(body.Encode())
331
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "GetWidgetImageUploadLease", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
434
+ requestConfig := requestConfig{
435
+ Method: "POST",
436
+ ProtoMethod: "GetWidgetImageUploadLease",
437
+ BodyType: FORM_CAMEL,
438
+ Body: bodyBytes,
439
+ Path: hydratedPath,
440
+ }
441
+ err := s.doRequest(ctx, requestConfig, &resp)
332
442
  if err != nil {
333
443
  return nil, err
334
444
  }
@@ -344,7 +454,14 @@ func (s *RedditHttpPlugin) OrderWidgets(ctx context.Context, req *redditapi.Orde
344
454
  body["order"] = req.Order
345
455
  body["subreddit"] = req.Subreddit
346
456
  bodyBytes, _ := json.Marshal(body)
347
- err := s.doRequest(ctx, requestConfig{Method: "PATCH", ProtoMethod: "OrderWidgets", BodyType: JSON_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
457
+ requestConfig := requestConfig{
458
+ Method: "PATCH",
459
+ ProtoMethod: "OrderWidgets",
460
+ BodyType: JSON_CAMEL,
461
+ Body: bodyBytes,
462
+ Path: hydratedPath,
463
+ }
464
+ err := s.doRequest(ctx, requestConfig, &resp)
348
465
  if err != nil {
349
466
  return nil, err
350
467
  }
@@ -356,7 +473,12 @@ func (s *RedditHttpPlugin) GetWidgets(ctx context.Context, req *redditapi.GetWid
356
473
  hydratedPath := fmt.Sprintf(
357
474
  "/r/%v/api/widgets?raw_json=1",
358
475
  req.Subreddit)
359
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetWidgets", Path: hydratedPath}, &resp)
476
+ requestConfig := requestConfig{
477
+ Method: "GET",
478
+ ProtoMethod: "GetWidgets",
479
+ Path: hydratedPath,
480
+ }
481
+ err := s.doRequest(ctx, requestConfig, &resp)
360
482
  if err != nil {
361
483
  return nil, err
362
484
  }
@@ -17,7 +17,12 @@ func (s *RedditHttpPlugin) GetWikiPages(ctx context.Context, req *redditapi.GetW
17
17
  hydratedPath := fmt.Sprintf(
18
18
  "/r/%v/wiki/pages?raw_json=1",
19
19
  req.Subreddit)
20
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetWikiPages", Path: hydratedPath}, &resp)
20
+ requestConfig := requestConfig{
21
+ Method: "GET",
22
+ ProtoMethod: "GetWikiPages",
23
+ Path: hydratedPath,
24
+ }
25
+ err := s.doRequest(ctx, requestConfig, &resp)
21
26
  if err != nil {
22
27
  return nil, err
23
28
  }
@@ -29,7 +34,12 @@ func (s *RedditHttpPlugin) GetWikiPage(ctx context.Context, req *redditapi.GetWi
29
34
  "/r/%v/wiki/%v?raw_json=1",
30
35
  req.Subreddit,
31
36
  req.Page)
32
- respBody, err := s.doRequestRaw(ctx, requestConfig{Method: "GET", ProtoMethod: "GetWikiPage", Path: hydratedPath})
37
+ requestConfig := requestConfig{
38
+ Method: "GET",
39
+ ProtoMethod: "GetWikiPage",
40
+ Path: hydratedPath,
41
+ }
42
+ respBody, err := s.doRequestRaw(ctx, requestConfig)
33
43
  if err != nil {
34
44
  return nil, err
35
45
  }
@@ -54,7 +64,14 @@ func (s *RedditHttpPlugin) EditWikiPage(ctx context.Context, req *redditapi.Edit
54
64
  body.Add("reason", req.Reason)
55
65
  body.Add("subreddit", req.Subreddit)
56
66
  bodyBytes := []byte(body.Encode())
57
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "EditWikiPage", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
67
+ requestConfig := requestConfig{
68
+ Method: "POST",
69
+ ProtoMethod: "EditWikiPage",
70
+ BodyType: FORM_SNAKE,
71
+ Body: bodyBytes,
72
+ Path: hydratedPath,
73
+ }
74
+ err := s.doRequest(ctx, requestConfig, &resp)
58
75
  if err != nil {
59
76
  return nil, err
60
77
  }
@@ -71,7 +88,14 @@ func (s *RedditHttpPlugin) HideWikiPageRevision(ctx context.Context, req *reddit
71
88
  body.Add("revision", req.Revision)
72
89
  body.Add("subreddit", req.Subreddit)
73
90
  bodyBytes := []byte(body.Encode())
74
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "HideWikiPageRevision", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
91
+ requestConfig := requestConfig{
92
+ Method: "POST",
93
+ ProtoMethod: "HideWikiPageRevision",
94
+ BodyType: FORM_SNAKE,
95
+ Body: bodyBytes,
96
+ Path: hydratedPath,
97
+ }
98
+ err := s.doRequest(ctx, requestConfig, &resp)
75
99
  if err != nil {
76
100
  return nil, err
77
101
  }
@@ -114,7 +138,12 @@ func (s *RedditHttpPlugin) GetWikiPageRevisions(ctx context.Context, req *reddit
114
138
  tmpLimitValue,
115
139
  tmpShowValue,
116
140
  tmpSrDetailValue)
117
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetWikiPageRevisions", Path: hydratedPath}, &resp)
141
+ requestConfig := requestConfig{
142
+ Method: "GET",
143
+ ProtoMethod: "GetWikiPageRevisions",
144
+ Path: hydratedPath,
145
+ }
146
+ err := s.doRequest(ctx, requestConfig, &resp)
118
147
  if err != nil {
119
148
  return nil, err
120
149
  }
@@ -156,7 +185,12 @@ func (s *RedditHttpPlugin) GetWikiRevisions(ctx context.Context, req *redditapi.
156
185
  tmpLimitValue,
157
186
  tmpShowValue,
158
187
  tmpSrDetailValue)
159
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetWikiRevisions", Path: hydratedPath}, &resp)
188
+ requestConfig := requestConfig{
189
+ Method: "GET",
190
+ ProtoMethod: "GetWikiRevisions",
191
+ Path: hydratedPath,
192
+ }
193
+ err := s.doRequest(ctx, requestConfig, &resp)
160
194
  if err != nil {
161
195
  return nil, err
162
196
  }
@@ -173,7 +207,14 @@ func (s *RedditHttpPlugin) RevertWikiPage(ctx context.Context, req *redditapi.Re
173
207
  body.Add("revision", req.Revision)
174
208
  body.Add("subreddit", req.Subreddit)
175
209
  bodyBytes := []byte(body.Encode())
176
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "RevertWikiPage", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
210
+ requestConfig := requestConfig{
211
+ Method: "POST",
212
+ ProtoMethod: "RevertWikiPage",
213
+ BodyType: FORM_SNAKE,
214
+ Body: bodyBytes,
215
+ Path: hydratedPath,
216
+ }
217
+ err := s.doRequest(ctx, requestConfig, &resp)
177
218
  if err != nil {
178
219
  return nil, err
179
220
  }
@@ -186,7 +227,12 @@ func (s *RedditHttpPlugin) GetWikiPageSettings(ctx context.Context, req *reddita
186
227
  "/r/%v/wiki/settings/%v?raw_json=1",
187
228
  req.Subreddit,
188
229
  req.Page)
189
- err := s.doRequest(ctx, requestConfig{Method: "GET", ProtoMethod: "GetWikiPageSettings", Path: hydratedPath}, &resp)
230
+ requestConfig := requestConfig{
231
+ Method: "GET",
232
+ ProtoMethod: "GetWikiPageSettings",
233
+ Path: hydratedPath,
234
+ }
235
+ err := s.doRequest(ctx, requestConfig, &resp)
190
236
  if err != nil {
191
237
  return nil, err
192
238
  }
@@ -205,7 +251,14 @@ func (s *RedditHttpPlugin) UpdateWikiPageSettings(ctx context.Context, req *redd
205
251
  body.Add("permlevel", strconv.Itoa(int(req.Permlevel)))
206
252
  body.Add("subreddit", req.Subreddit)
207
253
  bodyBytes := []byte(body.Encode())
208
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "UpdateWikiPageSettings", BodyType: FORM_CAMEL, Body: bodyBytes, Path: hydratedPath}, &resp)
254
+ requestConfig := requestConfig{
255
+ Method: "POST",
256
+ ProtoMethod: "UpdateWikiPageSettings",
257
+ BodyType: FORM_CAMEL,
258
+ Body: bodyBytes,
259
+ Path: hydratedPath,
260
+ }
261
+ err := s.doRequest(ctx, requestConfig, &resp)
209
262
  if err != nil {
210
263
  return nil, err
211
264
  }
@@ -224,7 +277,14 @@ func (s *RedditHttpPlugin) AllowEditor(ctx context.Context, req *redditapi.Allow
224
277
  body.Add("subreddit", req.Subreddit)
225
278
  body.Add("username", req.Username)
226
279
  bodyBytes := []byte(body.Encode())
227
- err := s.doRequest(ctx, requestConfig{Method: "POST", ProtoMethod: "AllowEditor", BodyType: FORM_SNAKE, Body: bodyBytes, Path: hydratedPath}, &resp)
280
+ requestConfig := requestConfig{
281
+ Method: "POST",
282
+ ProtoMethod: "AllowEditor",
283
+ BodyType: FORM_SNAKE,
284
+ Body: bodyBytes,
285
+ Path: hydratedPath,
286
+ }
287
+ err := s.doRequest(ctx, requestConfig, &resp)
228
288
  if err != nil {
229
289
  return nil, err
230
290
  }
@@ -647,6 +647,9 @@ message ApiClientConfig {
647
647
  // For methods that accept a `run_as` field, this specifies the scopes that the user must authorize
648
648
  // in order to call the method with runAs="USER".
649
649
  repeated .reddit.devvit.app_permission.v1.Scope run_as_user_scopes = 9;
650
+
651
+ // For methods that implicitly run as user.
652
+ bool always_run_as_user = 10;
650
653
  }
651
654
 
652
655
  // Indicates who the request should be made on behalf of. Currently, only 'APP' or 'USER' types are supported.
@@ -93,6 +93,8 @@ service Subreddits {
93
93
  option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
94
94
  option (devvit.plugin.redditapi.common.api_client_config).path = '/api/subscribe';
95
95
  option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
96
+ option (devvit.plugin.redditapi.common.api_client_config).run_as_user_scopes = SUBSCRIBE_TO_SUBREDDIT;
97
+ option (devvit.plugin.redditapi.common.api_client_config).always_run_as_user = true;
96
98
  }
97
99
 
98
100
  // https://www.reddit.com/dev/api#POST_api_upload_sr_img
Binary file
Binary file
@@ -782,6 +782,8 @@ export interface ApiClientConfig {
782
782
  * in order to call the method with runAs="USER".
783
783
  */
784
784
  runAsUserScopes: Scope[];
785
+ /** For methods that implicitly run as user. */
786
+ alwaysRunAsUser: boolean;
785
787
  }
786
788
  /** For methods with a request body, this specifies how the request body should be serialized. */
787
789
  export declare enum ApiClientConfig_BodyType {