@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.
- package/json/devvit/plugin/redditapi/common/common_msg.d.ts +2 -0
- package/json/devvit/plugin/redditapi/common/common_msg.d.ts.map +1 -1
- package/meta.min.json +6 -6
- package/package.json +4 -4
- package/protos.min.js +1 -1
- package/protos.min.js.map +2 -2
- package/schema/.snootobuf/deps/devvit/plugin/redditapi/common/common_msg.proto +3 -0
- package/schema/.snootobuf/deps/devvit/plugin/redditapi/subreddits/subreddits_svc.proto +2 -0
- package/schema/.snootobuf/output/go-redditapi/flair_svc.generated.go +96 -13
- package/schema/.snootobuf/output/go-redditapi/linksandcomments_svc.generated.go +181 -24
- package/schema/.snootobuf/output/go-redditapi/listings_svc.generated.go +48 -8
- package/schema/.snootobuf/output/go-redditapi/moderation_svc.generated.go +158 -22
- package/schema/.snootobuf/output/go-redditapi/modnote_svc.generated.go +34 -5
- package/schema/.snootobuf/output/go-redditapi/newmodmail_svc.generated.go +134 -20
- package/schema/.snootobuf/output/go-redditapi/privatemessages_svc.generated.go +78 -10
- package/schema/.snootobuf/output/go-redditapi/subreddits_svc.generated.go +180 -27
- package/schema/.snootobuf/output/go-redditapi/users_svc.generated.go +84 -12
- package/schema/.snootobuf/output/go-redditapi/widgets_svc.generated.go +140 -18
- package/schema/.snootobuf/output/go-redditapi/wiki_svc.generated.go +70 -10
- package/schema/devvit/plugin/redditapi/common/common_msg.proto +3 -0
- package/schema/devvit/plugin/redditapi/subreddits/subreddits_svc.proto +2 -0
- package/schema/snootobuf.lock +0 -0
- package/schema/snootobuf.redditapi.lock +0 -0
- package/types/devvit/plugin/redditapi/common/common_msg.d.ts +2 -0
- package/types/devvit/plugin/redditapi/common/common_msg.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/common/common_msg.js +15 -0
- package/types/devvit/plugin/redditapi/subreddits/subreddits_svc.d.ts +1 -1
- package/types/devvit/plugin/redditapi/subreddits/subreddits_svc.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/subreddits/subreddits_svc.js +2 -0
@@ -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
|
@@ -21,7 +21,14 @@ func (s *RedditHttpPlugin) ClearFlairTemplates(ctx context.Context, req *reddita
|
|
21
21
|
body.Add("flair_type", req.FlairType)
|
22
22
|
body.Add("subreddit", req.Subreddit)
|
23
23
|
bodyBytes := []byte(body.Encode())
|
24
|
-
|
24
|
+
requestConfig := requestConfig{
|
25
|
+
Method: "POST",
|
26
|
+
ProtoMethod: "ClearFlairTemplates",
|
27
|
+
BodyType: FORM_SNAKE,
|
28
|
+
Body: bodyBytes,
|
29
|
+
Path: hydratedPath,
|
30
|
+
}
|
31
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
25
32
|
if err != nil {
|
26
33
|
return nil, err
|
27
34
|
}
|
@@ -37,7 +44,14 @@ func (s *RedditHttpPlugin) DeleteFlair(ctx context.Context, req *redditapi.Delet
|
|
37
44
|
body.Add("name", req.Name)
|
38
45
|
body.Add("subreddit", req.Subreddit)
|
39
46
|
bodyBytes := []byte(body.Encode())
|
40
|
-
|
47
|
+
requestConfig := requestConfig{
|
48
|
+
Method: "POST",
|
49
|
+
ProtoMethod: "DeleteFlair",
|
50
|
+
BodyType: FORM_SNAKE,
|
51
|
+
Body: bodyBytes,
|
52
|
+
Path: hydratedPath,
|
53
|
+
}
|
54
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
41
55
|
if err != nil {
|
42
56
|
return nil, err
|
43
57
|
}
|
@@ -54,7 +68,14 @@ func (s *RedditHttpPlugin) DeleteFlairTemplate(ctx context.Context, req *reddita
|
|
54
68
|
body.Add("flair_template_id", req.FlairTemplateId)
|
55
69
|
body.Add("subreddit", req.Subreddit)
|
56
70
|
bodyBytes := []byte(body.Encode())
|
57
|
-
|
71
|
+
requestConfig := requestConfig{
|
72
|
+
Method: "POST",
|
73
|
+
ProtoMethod: "DeleteFlairTemplate",
|
74
|
+
BodyType: FORM_SNAKE,
|
75
|
+
Body: bodyBytes,
|
76
|
+
Path: hydratedPath,
|
77
|
+
}
|
78
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
58
79
|
if err != nil {
|
59
80
|
return nil, err
|
60
81
|
}
|
@@ -82,7 +103,14 @@ func (s *RedditHttpPlugin) Flair(ctx context.Context, req *redditapi.FlairReques
|
|
82
103
|
body.Add("text", req.Text.GetValue())
|
83
104
|
}
|
84
105
|
bodyBytes := []byte(body.Encode())
|
85
|
-
|
106
|
+
requestConfig := requestConfig{
|
107
|
+
Method: "POST",
|
108
|
+
ProtoMethod: "Flair",
|
109
|
+
BodyType: FORM_SNAKE,
|
110
|
+
Body: bodyBytes,
|
111
|
+
Path: hydratedPath,
|
112
|
+
}
|
113
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
86
114
|
if err != nil {
|
87
115
|
return nil, err
|
88
116
|
}
|
@@ -103,7 +131,14 @@ func (s *RedditHttpPlugin) FlairConfig(ctx context.Context, req *redditapi.Flair
|
|
103
131
|
body.Add("link_flair_self_assign_enabled", strconv.FormatBool(req.LinkFlairSelfAssignEnabled))
|
104
132
|
body.Add("subreddit", req.Subreddit)
|
105
133
|
bodyBytes := []byte(body.Encode())
|
106
|
-
|
134
|
+
requestConfig := requestConfig{
|
135
|
+
Method: "POST",
|
136
|
+
ProtoMethod: "FlairConfig",
|
137
|
+
BodyType: FORM_SNAKE,
|
138
|
+
Body: bodyBytes,
|
139
|
+
Path: hydratedPath,
|
140
|
+
}
|
141
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
107
142
|
if err != nil {
|
108
143
|
return nil, err
|
109
144
|
}
|
@@ -119,7 +154,14 @@ func (s *RedditHttpPlugin) FlairCsv(ctx context.Context, req *redditapi.FlairCsv
|
|
119
154
|
body.Add("flair_csv", req.FlairCsv)
|
120
155
|
body.Add("subreddit", req.Subreddit)
|
121
156
|
bodyBytes := []byte(body.Encode())
|
122
|
-
|
157
|
+
requestConfig := requestConfig{
|
158
|
+
Method: "POST",
|
159
|
+
ProtoMethod: "FlairCsv",
|
160
|
+
BodyType: FORM_SNAKE,
|
161
|
+
Body: bodyBytes,
|
162
|
+
Path: hydratedPath,
|
163
|
+
}
|
164
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
123
165
|
if err != nil {
|
124
166
|
return nil, err
|
125
167
|
}
|
@@ -168,7 +210,12 @@ func (s *RedditHttpPlugin) FlairList(ctx context.Context, req *redditapi.FlairLi
|
|
168
210
|
tmpLimitValue,
|
169
211
|
tmpNameValue,
|
170
212
|
tmpShowValue)
|
171
|
-
|
213
|
+
requestConfig := requestConfig{
|
214
|
+
Method: "GET",
|
215
|
+
ProtoMethod: "FlairList",
|
216
|
+
Path: hydratedPath,
|
217
|
+
}
|
218
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
172
219
|
if err != nil {
|
173
220
|
return nil, err
|
174
221
|
}
|
@@ -187,7 +234,12 @@ func (s *RedditHttpPlugin) FlairSelector(ctx context.Context, req *redditapi.Fla
|
|
187
234
|
req.Name,
|
188
235
|
tmpLinkValue,
|
189
236
|
req.IsNewlink)
|
190
|
-
|
237
|
+
requestConfig := requestConfig{
|
238
|
+
Method: "POST",
|
239
|
+
ProtoMethod: "FlairSelector",
|
240
|
+
Path: hydratedPath,
|
241
|
+
}
|
242
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
191
243
|
if err != nil {
|
192
244
|
return nil, err
|
193
245
|
}
|
@@ -214,7 +266,14 @@ func (s *RedditHttpPlugin) FlairTemplate(ctx context.Context, req *redditapi.Fla
|
|
214
266
|
body.Add("text_color", req.TextColor)
|
215
267
|
body.Add("text_editable", strconv.FormatBool(req.TextEditable))
|
216
268
|
bodyBytes := []byte(body.Encode())
|
217
|
-
|
269
|
+
requestConfig := requestConfig{
|
270
|
+
Method: "POST",
|
271
|
+
ProtoMethod: "FlairTemplate",
|
272
|
+
BodyType: FORM_SNAKE,
|
273
|
+
Body: bodyBytes,
|
274
|
+
Path: hydratedPath,
|
275
|
+
}
|
276
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
218
277
|
if err != nil {
|
219
278
|
return nil, err
|
220
279
|
}
|
@@ -225,7 +284,12 @@ func (s *RedditHttpPlugin) LinkFlair(ctx context.Context, req *redditapi.LinkFla
|
|
225
284
|
hydratedPath := fmt.Sprintf(
|
226
285
|
"/r/%v/api/link_flair_v2?raw_json=1",
|
227
286
|
req.Subreddit)
|
228
|
-
|
287
|
+
requestConfig := requestConfig{
|
288
|
+
Method: "GET",
|
289
|
+
ProtoMethod: "LinkFlair",
|
290
|
+
Path: hydratedPath,
|
291
|
+
}
|
292
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
229
293
|
if err != nil {
|
230
294
|
return nil, err
|
231
295
|
}
|
@@ -256,7 +320,14 @@ func (s *RedditHttpPlugin) SelectFlair(ctx context.Context, req *redditapi.Selec
|
|
256
320
|
body.Add("text", req.Text)
|
257
321
|
body.Add("text_color", req.TextColor)
|
258
322
|
bodyBytes := []byte(body.Encode())
|
259
|
-
|
323
|
+
requestConfig := requestConfig{
|
324
|
+
Method: "POST",
|
325
|
+
ProtoMethod: "SelectFlair",
|
326
|
+
BodyType: FORM_SNAKE,
|
327
|
+
Body: bodyBytes,
|
328
|
+
Path: hydratedPath,
|
329
|
+
}
|
330
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
260
331
|
if err != nil {
|
261
332
|
return nil, err
|
262
333
|
}
|
@@ -273,7 +344,14 @@ func (s *RedditHttpPlugin) SetFlairEnabled(ctx context.Context, req *redditapi.S
|
|
273
344
|
body.Add("flair_enabled", strconv.FormatBool(req.FlairEnabled))
|
274
345
|
body.Add("subreddit", req.Subreddit)
|
275
346
|
bodyBytes := []byte(body.Encode())
|
276
|
-
|
347
|
+
requestConfig := requestConfig{
|
348
|
+
Method: "POST",
|
349
|
+
ProtoMethod: "SetFlairEnabled",
|
350
|
+
BodyType: FORM_SNAKE,
|
351
|
+
Body: bodyBytes,
|
352
|
+
Path: hydratedPath,
|
353
|
+
}
|
354
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
277
355
|
if err != nil {
|
278
356
|
return nil, err
|
279
357
|
}
|
@@ -284,7 +362,12 @@ func (s *RedditHttpPlugin) UserFlair(ctx context.Context, req *redditapi.LinkFla
|
|
284
362
|
hydratedPath := fmt.Sprintf(
|
285
363
|
"/r/%v/api/user_flair_v2?raw_json=1",
|
286
364
|
req.Subreddit)
|
287
|
-
|
365
|
+
requestConfig := requestConfig{
|
366
|
+
Method: "GET",
|
367
|
+
ProtoMethod: "UserFlair",
|
368
|
+
Path: hydratedPath,
|
369
|
+
}
|
370
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
288
371
|
if err != nil {
|
289
372
|
return nil, err
|
290
373
|
}
|
@@ -21,11 +21,18 @@ func (s *RedditHttpPlugin) Comment(ctx context.Context, req *redditapi.CommentRe
|
|
21
21
|
body.Add("richtext_json", req.RichtextJson.GetValue())
|
22
22
|
}
|
23
23
|
body.Add("run_as", req.RunAs.String())
|
24
|
-
body.Add("run_as_user_scopes", "SUBMIT_COMMENT")
|
25
24
|
body.Add("text", req.Text)
|
26
25
|
body.Add("thing_id", req.ThingId)
|
27
26
|
bodyBytes := []byte(body.Encode())
|
28
|
-
|
27
|
+
requestConfig := requestConfig{
|
28
|
+
Method: "POST",
|
29
|
+
ProtoMethod: "Comment",
|
30
|
+
BodyType: FORM_SNAKE,
|
31
|
+
Body: bodyBytes,
|
32
|
+
Path: hydratedPath,
|
33
|
+
RunAsUserScopes: []string{"SUBMIT_COMMENT"},
|
34
|
+
}
|
35
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
29
36
|
if err != nil {
|
30
37
|
return nil, err
|
31
38
|
}
|
@@ -45,7 +52,14 @@ func (s *RedditHttpPlugin) Del(ctx context.Context, req *redditapi.BasicIdReques
|
|
45
52
|
body := url.Values{}
|
46
53
|
body.Add("id", req.Id)
|
47
54
|
bodyBytes := []byte(body.Encode())
|
48
|
-
|
55
|
+
requestConfig := requestConfig{
|
56
|
+
Method: "POST",
|
57
|
+
ProtoMethod: "Del",
|
58
|
+
BodyType: FORM_SNAKE,
|
59
|
+
Body: bodyBytes,
|
60
|
+
Path: hydratedPath,
|
61
|
+
}
|
62
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
49
63
|
if err != nil {
|
50
64
|
return nil, err
|
51
65
|
}
|
@@ -63,7 +77,14 @@ func (s *RedditHttpPlugin) EditUserText(ctx context.Context, req *redditapi.Comm
|
|
63
77
|
body.Add("text", req.Text)
|
64
78
|
body.Add("thing_id", req.ThingId)
|
65
79
|
bodyBytes := []byte(body.Encode())
|
66
|
-
|
80
|
+
requestConfig := requestConfig{
|
81
|
+
Method: "POST",
|
82
|
+
ProtoMethod: "EditUserText",
|
83
|
+
BodyType: FORM_SNAKE,
|
84
|
+
Body: bodyBytes,
|
85
|
+
Path: hydratedPath,
|
86
|
+
}
|
87
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
67
88
|
if err != nil {
|
68
89
|
return nil, err
|
69
90
|
}
|
@@ -84,7 +105,14 @@ func (s *RedditHttpPlugin) FollowPost(ctx context.Context, req *redditapi.Follow
|
|
84
105
|
body.Add("follow", strconv.FormatBool(req.Follow))
|
85
106
|
body.Add("fullname", req.Fullname)
|
86
107
|
bodyBytes := []byte(body.Encode())
|
87
|
-
|
108
|
+
requestConfig := requestConfig{
|
109
|
+
Method: "POST",
|
110
|
+
ProtoMethod: "FollowPost",
|
111
|
+
BodyType: FORM_SNAKE,
|
112
|
+
Body: bodyBytes,
|
113
|
+
Path: hydratedPath,
|
114
|
+
}
|
115
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
88
116
|
if err != nil {
|
89
117
|
return nil, err
|
90
118
|
}
|
@@ -97,7 +125,14 @@ func (s *RedditHttpPlugin) Hide(ctx context.Context, req *redditapi.BasicIdReque
|
|
97
125
|
body := url.Values{}
|
98
126
|
body.Add("id", req.Id)
|
99
127
|
bodyBytes := []byte(body.Encode())
|
100
|
-
|
128
|
+
requestConfig := requestConfig{
|
129
|
+
Method: "POST",
|
130
|
+
ProtoMethod: "Hide",
|
131
|
+
BodyType: FORM_SNAKE,
|
132
|
+
Body: bodyBytes,
|
133
|
+
Path: hydratedPath,
|
134
|
+
}
|
135
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
101
136
|
if err != nil {
|
102
137
|
return nil, err
|
103
138
|
}
|
@@ -115,7 +150,12 @@ func (s *RedditHttpPlugin) Info(ctx context.Context, req *redditapi.InfoRequest)
|
|
115
150
|
strings.Join(req.Subreddits, ","),
|
116
151
|
strings.Join(req.ThingIds, ","),
|
117
152
|
tmpUrlValue)
|
118
|
-
|
153
|
+
requestConfig := requestConfig{
|
154
|
+
Method: "GET",
|
155
|
+
ProtoMethod: "Info",
|
156
|
+
Path: hydratedPath,
|
157
|
+
}
|
158
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
119
159
|
if err != nil {
|
120
160
|
return nil, err
|
121
161
|
}
|
@@ -128,7 +168,14 @@ func (s *RedditHttpPlugin) Lock(ctx context.Context, req *redditapi.BasicIdReque
|
|
128
168
|
body := url.Values{}
|
129
169
|
body.Add("id", req.Id)
|
130
170
|
bodyBytes := []byte(body.Encode())
|
131
|
-
|
171
|
+
requestConfig := requestConfig{
|
172
|
+
Method: "POST",
|
173
|
+
ProtoMethod: "Lock",
|
174
|
+
BodyType: FORM_SNAKE,
|
175
|
+
Body: bodyBytes,
|
176
|
+
Path: hydratedPath,
|
177
|
+
}
|
178
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
132
179
|
if err != nil {
|
133
180
|
return nil, err
|
134
181
|
}
|
@@ -141,7 +188,14 @@ func (s *RedditHttpPlugin) MarkNSFW(ctx context.Context, req *redditapi.BasicIdR
|
|
141
188
|
body := url.Values{}
|
142
189
|
body.Add("id", req.Id)
|
143
190
|
bodyBytes := []byte(body.Encode())
|
144
|
-
|
191
|
+
requestConfig := requestConfig{
|
192
|
+
Method: "POST",
|
193
|
+
ProtoMethod: "MarkNSFW",
|
194
|
+
BodyType: FORM_SNAKE,
|
195
|
+
Body: bodyBytes,
|
196
|
+
Path: hydratedPath,
|
197
|
+
}
|
198
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
145
199
|
if err != nil {
|
146
200
|
return nil, err
|
147
201
|
}
|
@@ -173,7 +227,12 @@ func (s *RedditHttpPlugin) MoreChildren(ctx context.Context, req *redditapi.More
|
|
173
227
|
tmpLimitChildrenValue,
|
174
228
|
req.LinkId,
|
175
229
|
tmpSortValue)
|
176
|
-
|
230
|
+
requestConfig := requestConfig{
|
231
|
+
Method: "GET",
|
232
|
+
ProtoMethod: "MoreChildren",
|
233
|
+
Path: hydratedPath,
|
234
|
+
}
|
235
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
177
236
|
if err != nil {
|
178
237
|
return nil, err
|
179
238
|
}
|
@@ -219,7 +278,14 @@ func (s *RedditHttpPlugin) Report(ctx context.Context, req *redditapi.ReportRequ
|
|
219
278
|
body.Add("usernames", req.Usernames.GetValue())
|
220
279
|
}
|
221
280
|
bodyBytes := []byte(body.Encode())
|
222
|
-
|
281
|
+
requestConfig := requestConfig{
|
282
|
+
Method: "POST",
|
283
|
+
ProtoMethod: "Report",
|
284
|
+
BodyType: FORM_SNAKE,
|
285
|
+
Body: bodyBytes,
|
286
|
+
Path: hydratedPath,
|
287
|
+
}
|
288
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
223
289
|
if err != nil {
|
224
290
|
return nil, err
|
225
291
|
}
|
@@ -235,7 +301,14 @@ func (s *RedditHttpPlugin) ReportAward(ctx context.Context, req *redditapi.Repor
|
|
235
301
|
body.Add("reason", req.Reason.GetValue())
|
236
302
|
}
|
237
303
|
bodyBytes := []byte(body.Encode())
|
238
|
-
|
304
|
+
requestConfig := requestConfig{
|
305
|
+
Method: "POST",
|
306
|
+
ProtoMethod: "ReportAward",
|
307
|
+
BodyType: FORM_SNAKE,
|
308
|
+
Body: bodyBytes,
|
309
|
+
Path: hydratedPath,
|
310
|
+
}
|
311
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
239
312
|
if err != nil {
|
240
313
|
return nil, err
|
241
314
|
}
|
@@ -248,7 +321,14 @@ func (s *RedditHttpPlugin) Save(ctx context.Context, req *redditapi.SaveRequest)
|
|
248
321
|
body := url.Values{}
|
249
322
|
body.Add("id", req.Id)
|
250
323
|
bodyBytes := []byte(body.Encode())
|
251
|
-
|
324
|
+
requestConfig := requestConfig{
|
325
|
+
Method: "POST",
|
326
|
+
ProtoMethod: "Save",
|
327
|
+
BodyType: FORM_SNAKE,
|
328
|
+
Body: bodyBytes,
|
329
|
+
Path: hydratedPath,
|
330
|
+
}
|
331
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
252
332
|
if err != nil {
|
253
333
|
return nil, err
|
254
334
|
}
|
@@ -262,7 +342,14 @@ func (s *RedditHttpPlugin) SendReplies(ctx context.Context, req *redditapi.SendR
|
|
262
342
|
body.Add("id", req.Id)
|
263
343
|
body.Add("state", strconv.FormatBool(req.State))
|
264
344
|
bodyBytes := []byte(body.Encode())
|
265
|
-
|
345
|
+
requestConfig := requestConfig{
|
346
|
+
Method: "POST",
|
347
|
+
ProtoMethod: "SendReplies",
|
348
|
+
BodyType: FORM_SNAKE,
|
349
|
+
Body: bodyBytes,
|
350
|
+
Path: hydratedPath,
|
351
|
+
}
|
352
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
266
353
|
if err != nil {
|
267
354
|
return nil, err
|
268
355
|
}
|
@@ -277,7 +364,14 @@ func (s *RedditHttpPlugin) SetContestMode(ctx context.Context, req *redditapi.Se
|
|
277
364
|
body.Add("id", req.Id)
|
278
365
|
body.Add("state", strconv.FormatBool(req.State))
|
279
366
|
bodyBytes := []byte(body.Encode())
|
280
|
-
|
367
|
+
requestConfig := requestConfig{
|
368
|
+
Method: "POST",
|
369
|
+
ProtoMethod: "SetContestMode",
|
370
|
+
BodyType: FORM_SNAKE,
|
371
|
+
Body: bodyBytes,
|
372
|
+
Path: hydratedPath,
|
373
|
+
}
|
374
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
281
375
|
if err != nil {
|
282
376
|
return nil, err
|
283
377
|
}
|
@@ -298,7 +392,14 @@ func (s *RedditHttpPlugin) SetSubredditSticky(ctx context.Context, req *redditap
|
|
298
392
|
body.Add("to_profile", strconv.FormatBool(req.ToProfile.GetValue()))
|
299
393
|
}
|
300
394
|
bodyBytes := []byte(body.Encode())
|
301
|
-
|
395
|
+
requestConfig := requestConfig{
|
396
|
+
Method: "POST",
|
397
|
+
ProtoMethod: "SetSubredditSticky",
|
398
|
+
BodyType: FORM_SNAKE,
|
399
|
+
Body: bodyBytes,
|
400
|
+
Path: hydratedPath,
|
401
|
+
}
|
402
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
302
403
|
if err != nil {
|
303
404
|
return nil, err
|
304
405
|
}
|
@@ -313,7 +414,14 @@ func (s *RedditHttpPlugin) SetSuggestedSort(ctx context.Context, req *redditapi.
|
|
313
414
|
body.Add("id", req.Id)
|
314
415
|
body.Add("sort", req.Sort)
|
315
416
|
bodyBytes := []byte(body.Encode())
|
316
|
-
|
417
|
+
requestConfig := requestConfig{
|
418
|
+
Method: "POST",
|
419
|
+
ProtoMethod: "SetSuggestedSort",
|
420
|
+
BodyType: FORM_SNAKE,
|
421
|
+
Body: bodyBytes,
|
422
|
+
Path: hydratedPath,
|
423
|
+
}
|
424
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
317
425
|
if err != nil {
|
318
426
|
return nil, err
|
319
427
|
}
|
@@ -326,7 +434,14 @@ func (s *RedditHttpPlugin) Spoiler(ctx context.Context, req *redditapi.BasicIdRe
|
|
326
434
|
body := url.Values{}
|
327
435
|
body.Add("id", req.Id)
|
328
436
|
bodyBytes := []byte(body.Encode())
|
329
|
-
|
437
|
+
requestConfig := requestConfig{
|
438
|
+
Method: "POST",
|
439
|
+
ProtoMethod: "Spoiler",
|
440
|
+
BodyType: FORM_SNAKE,
|
441
|
+
Body: bodyBytes,
|
442
|
+
Path: hydratedPath,
|
443
|
+
}
|
444
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
330
445
|
if err != nil {
|
331
446
|
return nil, err
|
332
447
|
}
|
@@ -339,7 +454,14 @@ func (s *RedditHttpPlugin) Unhide(ctx context.Context, req *redditapi.BasicIdReq
|
|
339
454
|
body := url.Values{}
|
340
455
|
body.Add("id", req.Id)
|
341
456
|
bodyBytes := []byte(body.Encode())
|
342
|
-
|
457
|
+
requestConfig := requestConfig{
|
458
|
+
Method: "POST",
|
459
|
+
ProtoMethod: "Unhide",
|
460
|
+
BodyType: FORM_SNAKE,
|
461
|
+
Body: bodyBytes,
|
462
|
+
Path: hydratedPath,
|
463
|
+
}
|
464
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
343
465
|
if err != nil {
|
344
466
|
return nil, err
|
345
467
|
}
|
@@ -352,7 +474,14 @@ func (s *RedditHttpPlugin) Unlock(ctx context.Context, req *redditapi.BasicIdReq
|
|
352
474
|
body := url.Values{}
|
353
475
|
body.Add("id", req.Id)
|
354
476
|
bodyBytes := []byte(body.Encode())
|
355
|
-
|
477
|
+
requestConfig := requestConfig{
|
478
|
+
Method: "POST",
|
479
|
+
ProtoMethod: "Unlock",
|
480
|
+
BodyType: FORM_SNAKE,
|
481
|
+
Body: bodyBytes,
|
482
|
+
Path: hydratedPath,
|
483
|
+
}
|
484
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
356
485
|
if err != nil {
|
357
486
|
return nil, err
|
358
487
|
}
|
@@ -365,7 +494,14 @@ func (s *RedditHttpPlugin) UnmarkNSFW(ctx context.Context, req *redditapi.BasicI
|
|
365
494
|
body := url.Values{}
|
366
495
|
body.Add("id", req.Id)
|
367
496
|
bodyBytes := []byte(body.Encode())
|
368
|
-
|
497
|
+
requestConfig := requestConfig{
|
498
|
+
Method: "POST",
|
499
|
+
ProtoMethod: "UnmarkNSFW",
|
500
|
+
BodyType: FORM_SNAKE,
|
501
|
+
Body: bodyBytes,
|
502
|
+
Path: hydratedPath,
|
503
|
+
}
|
504
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
369
505
|
if err != nil {
|
370
506
|
return nil, err
|
371
507
|
}
|
@@ -378,7 +514,14 @@ func (s *RedditHttpPlugin) Unsave(ctx context.Context, req *redditapi.BasicIdReq
|
|
378
514
|
body := url.Values{}
|
379
515
|
body.Add("id", req.Id)
|
380
516
|
bodyBytes := []byte(body.Encode())
|
381
|
-
|
517
|
+
requestConfig := requestConfig{
|
518
|
+
Method: "POST",
|
519
|
+
ProtoMethod: "Unsave",
|
520
|
+
BodyType: FORM_SNAKE,
|
521
|
+
Body: bodyBytes,
|
522
|
+
Path: hydratedPath,
|
523
|
+
}
|
524
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
382
525
|
if err != nil {
|
383
526
|
return nil, err
|
384
527
|
}
|
@@ -391,7 +534,14 @@ func (s *RedditHttpPlugin) Unspoiler(ctx context.Context, req *redditapi.BasicId
|
|
391
534
|
body := url.Values{}
|
392
535
|
body.Add("id", req.Id)
|
393
536
|
bodyBytes := []byte(body.Encode())
|
394
|
-
|
537
|
+
requestConfig := requestConfig{
|
538
|
+
Method: "POST",
|
539
|
+
ProtoMethod: "Unspoiler",
|
540
|
+
BodyType: FORM_SNAKE,
|
541
|
+
Body: bodyBytes,
|
542
|
+
Path: hydratedPath,
|
543
|
+
}
|
544
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
395
545
|
if err != nil {
|
396
546
|
return nil, err
|
397
547
|
}
|
@@ -405,7 +555,14 @@ func (s *RedditHttpPlugin) Vote(ctx context.Context, req *redditapi.VoteRequest)
|
|
405
555
|
body.Add("dir", strconv.Itoa(int(req.Dir)))
|
406
556
|
body.Add("id", req.Id)
|
407
557
|
bodyBytes := []byte(body.Encode())
|
408
|
-
|
558
|
+
requestConfig := requestConfig{
|
559
|
+
Method: "POST",
|
560
|
+
ProtoMethod: "Vote",
|
561
|
+
BodyType: FORM_SNAKE,
|
562
|
+
Body: bodyBytes,
|
563
|
+
Path: hydratedPath,
|
564
|
+
}
|
565
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
409
566
|
if err != nil {
|
410
567
|
return nil, err
|
411
568
|
}
|
@@ -38,7 +38,12 @@ func (s *RedditHttpPlugin) Best(ctx context.Context, req *redditapi.GetBestReque
|
|
38
38
|
tmpCountValue,
|
39
39
|
tmpLimitValue,
|
40
40
|
tmpShowValue)
|
41
|
-
|
41
|
+
requestConfig := requestConfig{
|
42
|
+
Method: "GET",
|
43
|
+
ProtoMethod: "Best",
|
44
|
+
Path: hydratedPath,
|
45
|
+
}
|
46
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
42
47
|
if err != nil {
|
43
48
|
return nil, err
|
44
49
|
}
|
@@ -50,7 +55,12 @@ func (s *RedditHttpPlugin) ById(ctx context.Context, req *redditapi.GetByIdReque
|
|
50
55
|
hydratedPath := fmt.Sprintf(
|
51
56
|
"/by_id/%v.json?raw_json=1",
|
52
57
|
req.PostIds)
|
53
|
-
|
58
|
+
requestConfig := requestConfig{
|
59
|
+
Method: "GET",
|
60
|
+
ProtoMethod: "ById",
|
61
|
+
Path: hydratedPath,
|
62
|
+
}
|
63
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
54
64
|
if err != nil {
|
55
65
|
return nil, err
|
56
66
|
}
|
@@ -96,7 +106,12 @@ func (s *RedditHttpPlugin) Comments(ctx context.Context, req *redditapi.GetComme
|
|
96
106
|
tmpSortValue,
|
97
107
|
tmpThreadedValue,
|
98
108
|
tmpTruncateValue)
|
99
|
-
|
109
|
+
requestConfig := requestConfig{
|
110
|
+
Method: "GET",
|
111
|
+
ProtoMethod: "Comments",
|
112
|
+
Path: hydratedPath,
|
113
|
+
}
|
114
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
100
115
|
if err != nil {
|
101
116
|
return nil, err
|
102
117
|
}
|
@@ -154,7 +169,12 @@ func (s *RedditHttpPlugin) Duplicates(ctx context.Context, req *redditapi.GetDup
|
|
154
169
|
tmpCountValue,
|
155
170
|
tmpCrosspostsOnlyValue,
|
156
171
|
tmpShowValue)
|
157
|
-
|
172
|
+
requestConfig := requestConfig{
|
173
|
+
Method: "GET",
|
174
|
+
ProtoMethod: "Duplicates",
|
175
|
+
Path: hydratedPath,
|
176
|
+
}
|
177
|
+
respBody, err := s.doRequestRaw(ctx, requestConfig)
|
158
178
|
if err != nil {
|
159
179
|
return nil, err
|
160
180
|
}
|
@@ -207,7 +227,12 @@ func (s *RedditHttpPlugin) Hot(ctx context.Context, req *redditapi.GetHotRequest
|
|
207
227
|
tmpLimitValue,
|
208
228
|
tmpShowValue,
|
209
229
|
tmpGValue)
|
210
|
-
|
230
|
+
requestConfig := requestConfig{
|
231
|
+
Method: "GET",
|
232
|
+
ProtoMethod: "Hot",
|
233
|
+
Path: hydratedPath,
|
234
|
+
}
|
235
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
211
236
|
if err != nil {
|
212
237
|
return nil, err
|
213
238
|
}
|
@@ -248,7 +273,12 @@ func (s *RedditHttpPlugin) New(ctx context.Context, req *redditapi.GetNewRequest
|
|
248
273
|
tmpCountValue,
|
249
274
|
tmpLimitValue,
|
250
275
|
tmpShowValue)
|
251
|
-
|
276
|
+
requestConfig := requestConfig{
|
277
|
+
Method: "GET",
|
278
|
+
ProtoMethod: "New",
|
279
|
+
Path: hydratedPath,
|
280
|
+
}
|
281
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
252
282
|
if err != nil {
|
253
283
|
return nil, err
|
254
284
|
}
|
@@ -289,7 +319,12 @@ func (s *RedditHttpPlugin) Rising(ctx context.Context, req *redditapi.GetRisingR
|
|
289
319
|
tmpCountValue,
|
290
320
|
tmpLimitValue,
|
291
321
|
tmpShowValue)
|
292
|
-
|
322
|
+
requestConfig := requestConfig{
|
323
|
+
Method: "GET",
|
324
|
+
ProtoMethod: "Rising",
|
325
|
+
Path: hydratedPath,
|
326
|
+
}
|
327
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
293
328
|
if err != nil {
|
294
329
|
return nil, err
|
295
330
|
}
|
@@ -336,7 +371,12 @@ func (s *RedditHttpPlugin) Sort(ctx context.Context, req *redditapi.GetSortReque
|
|
336
371
|
tmpCountValue,
|
337
372
|
tmpShowValue,
|
338
373
|
tmpTValue)
|
339
|
-
|
374
|
+
requestConfig := requestConfig{
|
375
|
+
Method: "GET",
|
376
|
+
ProtoMethod: "Sort",
|
377
|
+
Path: hydratedPath,
|
378
|
+
}
|
379
|
+
err := s.doRequest(ctx, requestConfig, &resp)
|
340
380
|
if err != nil {
|
341
381
|
return nil, err
|
342
382
|
}
|