@devvit/protos 0.10.21-next-2024-05-13-e0c684b50.0 → 0.10.21-next-2024-05-13-376d4e59d.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,32 +6,24 @@
6
6
  /* eslint-disable */
7
7
  import _m0 from 'protobufjs/minimal.js';
8
8
  import { messageTypeRegistry } from '../../../../../typeRegistry.js';
9
- import { firehoseEventFromJSON, firehoseEventToJSON } from '../../../../options/options.js';
10
- import { subredditRatingFromJSON, subredditRatingToJSON, } from '../../../../reddit/v2alpha/subredditv2.js';
11
- function createBaseGetUISubscriptionsByOrganizationNameRequest() {
12
- return { organizationName: "" };
9
+ import { AccessToken } from './auth.js';
10
+ import { Organization } from './organization.js';
11
+ import { Subscription } from './subscription.js';
12
+ function createBaseUIGetOrganizationsRequest() {
13
+ return {};
13
14
  }
14
- export const GetUISubscriptionsByOrganizationNameRequest = {
15
- $type: "devvit.data.api.admin.v1alpha.GetUISubscriptionsByOrganizationNameRequest",
16
- encode(message, writer = _m0.Writer.create()) {
17
- if (message.organizationName !== "") {
18
- writer.uint32(10).string(message.organizationName);
19
- }
15
+ export const UIGetOrganizationsRequest = {
16
+ $type: "devvit.data.api.admin.v1alpha.UIGetOrganizationsRequest",
17
+ encode(_, writer = _m0.Writer.create()) {
20
18
  return writer;
21
19
  },
22
20
  decode(input, length) {
23
21
  const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
24
22
  let end = length === undefined ? reader.len : reader.pos + length;
25
- const message = createBaseGetUISubscriptionsByOrganizationNameRequest();
23
+ const message = createBaseUIGetOrganizationsRequest();
26
24
  while (reader.pos < end) {
27
25
  const tag = reader.uint32();
28
26
  switch (tag >>> 3) {
29
- case 1:
30
- if (tag !== 10) {
31
- break;
32
- }
33
- message.organizationName = reader.string();
34
- continue;
35
27
  }
36
28
  if ((tag & 7) === 4 || tag === 0) {
37
29
  break;
@@ -40,41 +32,37 @@ export const GetUISubscriptionsByOrganizationNameRequest = {
40
32
  }
41
33
  return message;
42
34
  },
43
- fromJSON(object) {
44
- return { organizationName: isSet(object.organizationName) ? globalThis.String(object.organizationName) : "" };
35
+ fromJSON(_) {
36
+ return {};
45
37
  },
46
- toJSON(message) {
38
+ toJSON(_) {
47
39
  const obj = {};
48
- if (message.organizationName !== "") {
49
- obj.organizationName = message.organizationName;
50
- }
51
40
  return obj;
52
41
  },
53
42
  create(base) {
54
- return GetUISubscriptionsByOrganizationNameRequest.fromPartial(base ?? {});
43
+ return UIGetOrganizationsRequest.fromPartial(base ?? {});
55
44
  },
56
- fromPartial(object) {
57
- const message = createBaseGetUISubscriptionsByOrganizationNameRequest();
58
- message.organizationName = object.organizationName ?? "";
45
+ fromPartial(_) {
46
+ const message = createBaseUIGetOrganizationsRequest();
59
47
  return message;
60
48
  },
61
49
  };
62
- messageTypeRegistry.set(GetUISubscriptionsByOrganizationNameRequest.$type, GetUISubscriptionsByOrganizationNameRequest);
63
- function createBaseGetUISubscriptionsByOrganizationNameResponse() {
64
- return { subscriptions: [] };
50
+ messageTypeRegistry.set(UIGetOrganizationsRequest.$type, UIGetOrganizationsRequest);
51
+ function createBaseUIGetOrganizationsResponse() {
52
+ return { organizations: [] };
65
53
  }
66
- export const GetUISubscriptionsByOrganizationNameResponse = {
67
- $type: "devvit.data.api.admin.v1alpha.GetUISubscriptionsByOrganizationNameResponse",
54
+ export const UIGetOrganizationsResponse = {
55
+ $type: "devvit.data.api.admin.v1alpha.UIGetOrganizationsResponse",
68
56
  encode(message, writer = _m0.Writer.create()) {
69
- for (const v of message.subscriptions) {
70
- GetUISubscriptionsByOrganizationNameResponse_Subscription.encode(v, writer.uint32(10).fork()).ldelim();
57
+ for (const v of message.organizations) {
58
+ UIGetOrganizationsResponse_HydratedOrganization.encode(v, writer.uint32(10).fork()).ldelim();
71
59
  }
72
60
  return writer;
73
61
  },
74
62
  decode(input, length) {
75
63
  const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
76
64
  let end = length === undefined ? reader.len : reader.pos + length;
77
- const message = createBaseGetUISubscriptionsByOrganizationNameResponse();
65
+ const message = createBaseUIGetOrganizationsResponse();
78
66
  while (reader.pos < end) {
79
67
  const tag = reader.uint32();
80
68
  switch (tag >>> 3) {
@@ -82,7 +70,7 @@ export const GetUISubscriptionsByOrganizationNameResponse = {
82
70
  if (tag !== 10) {
83
71
  break;
84
72
  }
85
- message.subscriptions.push(GetUISubscriptionsByOrganizationNameResponse_Subscription.decode(reader, reader.uint32()));
73
+ message.organizations.push(UIGetOrganizationsResponse_HydratedOrganization.decode(reader, reader.uint32()));
86
74
  continue;
87
75
  }
88
76
  if ((tag & 7) === 4 || tag === 0) {
@@ -94,159 +82,50 @@ export const GetUISubscriptionsByOrganizationNameResponse = {
94
82
  },
95
83
  fromJSON(object) {
96
84
  return {
97
- subscriptions: globalThis.Array.isArray(object?.subscriptions)
98
- ? object.subscriptions.map((e) => GetUISubscriptionsByOrganizationNameResponse_Subscription.fromJSON(e))
85
+ organizations: globalThis.Array.isArray(object?.organizations)
86
+ ? object.organizations.map((e) => UIGetOrganizationsResponse_HydratedOrganization.fromJSON(e))
99
87
  : [],
100
88
  };
101
89
  },
102
90
  toJSON(message) {
103
91
  const obj = {};
104
- if (message.subscriptions?.length) {
105
- obj.subscriptions = message.subscriptions.map((e) => GetUISubscriptionsByOrganizationNameResponse_Subscription.toJSON(e));
92
+ if (message.organizations?.length) {
93
+ obj.organizations = message.organizations.map((e) => UIGetOrganizationsResponse_HydratedOrganization.toJSON(e));
106
94
  }
107
95
  return obj;
108
96
  },
109
97
  create(base) {
110
- return GetUISubscriptionsByOrganizationNameResponse.fromPartial(base ?? {});
98
+ return UIGetOrganizationsResponse.fromPartial(base ?? {});
111
99
  },
112
100
  fromPartial(object) {
113
- const message = createBaseGetUISubscriptionsByOrganizationNameResponse();
114
- message.subscriptions =
115
- object.subscriptions?.map((e) => GetUISubscriptionsByOrganizationNameResponse_Subscription.fromPartial(e)) || [];
101
+ const message = createBaseUIGetOrganizationsResponse();
102
+ message.organizations =
103
+ object.organizations?.map((e) => UIGetOrganizationsResponse_HydratedOrganization.fromPartial(e)) || [];
116
104
  return message;
117
105
  },
118
106
  };
119
- messageTypeRegistry.set(GetUISubscriptionsByOrganizationNameResponse.$type, GetUISubscriptionsByOrganizationNameResponse);
120
- function createBaseGetUISubscriptionsByOrganizationNameResponse_SubredditInfo() {
121
- return { id: "", name: "", icon: "", isNsfw: false };
107
+ messageTypeRegistry.set(UIGetOrganizationsResponse.$type, UIGetOrganizationsResponse);
108
+ function createBaseUIGetOrganizationsResponse_HydratedOrganization() {
109
+ return { organization: undefined, subscriptions: [], acccessTokens: [] };
122
110
  }
123
- export const GetUISubscriptionsByOrganizationNameResponse_SubredditInfo = {
124
- $type: "devvit.data.api.admin.v1alpha.GetUISubscriptionsByOrganizationNameResponse.SubredditInfo",
111
+ export const UIGetOrganizationsResponse_HydratedOrganization = {
112
+ $type: "devvit.data.api.admin.v1alpha.UIGetOrganizationsResponse.HydratedOrganization",
125
113
  encode(message, writer = _m0.Writer.create()) {
126
- if (message.id !== "") {
127
- writer.uint32(10).string(message.id);
128
- }
129
- if (message.name !== "") {
130
- writer.uint32(18).string(message.name);
114
+ if (message.organization !== undefined) {
115
+ Organization.encode(message.organization, writer.uint32(10).fork()).ldelim();
131
116
  }
132
- if (message.icon !== "") {
133
- writer.uint32(26).string(message.icon);
134
- }
135
- if (message.isNsfw !== false) {
136
- writer.uint32(32).bool(message.isNsfw);
137
- }
138
- return writer;
139
- },
140
- decode(input, length) {
141
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
142
- let end = length === undefined ? reader.len : reader.pos + length;
143
- const message = createBaseGetUISubscriptionsByOrganizationNameResponse_SubredditInfo();
144
- while (reader.pos < end) {
145
- const tag = reader.uint32();
146
- switch (tag >>> 3) {
147
- case 1:
148
- if (tag !== 10) {
149
- break;
150
- }
151
- message.id = reader.string();
152
- continue;
153
- case 2:
154
- if (tag !== 18) {
155
- break;
156
- }
157
- message.name = reader.string();
158
- continue;
159
- case 3:
160
- if (tag !== 26) {
161
- break;
162
- }
163
- message.icon = reader.string();
164
- continue;
165
- case 4:
166
- if (tag !== 32) {
167
- break;
168
- }
169
- message.isNsfw = reader.bool();
170
- continue;
171
- }
172
- if ((tag & 7) === 4 || tag === 0) {
173
- break;
174
- }
175
- reader.skipType(tag & 7);
176
- }
177
- return message;
178
- },
179
- fromJSON(object) {
180
- return {
181
- id: isSet(object.id) ? globalThis.String(object.id) : "",
182
- name: isSet(object.name) ? globalThis.String(object.name) : "",
183
- icon: isSet(object.icon) ? globalThis.String(object.icon) : "",
184
- isNsfw: isSet(object.isNsfw) ? globalThis.Boolean(object.isNsfw) : false,
185
- };
186
- },
187
- toJSON(message) {
188
- const obj = {};
189
- if (message.id !== "") {
190
- obj.id = message.id;
191
- }
192
- if (message.name !== "") {
193
- obj.name = message.name;
194
- }
195
- if (message.icon !== "") {
196
- obj.icon = message.icon;
197
- }
198
- if (message.isNsfw !== false) {
199
- obj.isNsfw = message.isNsfw;
200
- }
201
- return obj;
202
- },
203
- create(base) {
204
- return GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.fromPartial(base ?? {});
205
- },
206
- fromPartial(object) {
207
- const message = createBaseGetUISubscriptionsByOrganizationNameResponse_SubredditInfo();
208
- message.id = object.id ?? "";
209
- message.name = object.name ?? "";
210
- message.icon = object.icon ?? "";
211
- message.isNsfw = object.isNsfw ?? false;
212
- return message;
213
- },
214
- };
215
- messageTypeRegistry.set(GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.$type, GetUISubscriptionsByOrganizationNameResponse_SubredditInfo);
216
- function createBaseGetUISubscriptionsByOrganizationNameResponse_Subscription() {
217
- return { id: "", name: "", description: "", events: [], subreddits: [], subredditRatings: [] };
218
- }
219
- export const GetUISubscriptionsByOrganizationNameResponse_Subscription = {
220
- $type: "devvit.data.api.admin.v1alpha.GetUISubscriptionsByOrganizationNameResponse.Subscription",
221
- encode(message, writer = _m0.Writer.create()) {
222
- if (message.id !== "") {
223
- writer.uint32(10).string(message.id);
224
- }
225
- if (message.name !== "") {
226
- writer.uint32(18).string(message.name);
227
- }
228
- if (message.description !== "") {
229
- writer.uint32(26).string(message.description);
230
- }
231
- writer.uint32(34).fork();
232
- for (const v of message.events) {
233
- writer.int32(v);
234
- }
235
- writer.ldelim();
236
- for (const v of message.subreddits) {
237
- GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.encode(v, writer.uint32(42).fork()).ldelim();
117
+ for (const v of message.subscriptions) {
118
+ Subscription.encode(v, writer.uint32(18).fork()).ldelim();
238
119
  }
239
- writer.uint32(50).fork();
240
- for (const v of message.subredditRatings) {
241
- writer.int32(v);
120
+ for (const v of message.acccessTokens) {
121
+ AccessToken.encode(v, writer.uint32(26).fork()).ldelim();
242
122
  }
243
- writer.ldelim();
244
123
  return writer;
245
124
  },
246
125
  decode(input, length) {
247
126
  const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
248
127
  let end = length === undefined ? reader.len : reader.pos + length;
249
- const message = createBaseGetUISubscriptionsByOrganizationNameResponse_Subscription();
128
+ const message = createBaseUIGetOrganizationsResponse_HydratedOrganization();
250
129
  while (reader.pos < end) {
251
130
  const tag = reader.uint32();
252
131
  switch (tag >>> 3) {
@@ -254,52 +133,20 @@ export const GetUISubscriptionsByOrganizationNameResponse_Subscription = {
254
133
  if (tag !== 10) {
255
134
  break;
256
135
  }
257
- message.id = reader.string();
136
+ message.organization = Organization.decode(reader, reader.uint32());
258
137
  continue;
259
138
  case 2:
260
139
  if (tag !== 18) {
261
140
  break;
262
141
  }
263
- message.name = reader.string();
142
+ message.subscriptions.push(Subscription.decode(reader, reader.uint32()));
264
143
  continue;
265
144
  case 3:
266
145
  if (tag !== 26) {
267
146
  break;
268
147
  }
269
- message.description = reader.string();
270
- continue;
271
- case 4:
272
- if (tag === 32) {
273
- message.events.push(reader.int32());
274
- continue;
275
- }
276
- if (tag === 34) {
277
- const end2 = reader.uint32() + reader.pos;
278
- while (reader.pos < end2) {
279
- message.events.push(reader.int32());
280
- }
281
- continue;
282
- }
283
- break;
284
- case 5:
285
- if (tag !== 42) {
286
- break;
287
- }
288
- message.subreddits.push(GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.decode(reader, reader.uint32()));
148
+ message.acccessTokens.push(AccessToken.decode(reader, reader.uint32()));
289
149
  continue;
290
- case 6:
291
- if (tag === 48) {
292
- message.subredditRatings.push(reader.int32());
293
- continue;
294
- }
295
- if (tag === 50) {
296
- const end2 = reader.uint32() + reader.pos;
297
- while (reader.pos < end2) {
298
- message.subredditRatings.push(reader.int32());
299
- }
300
- continue;
301
- }
302
- break;
303
150
  }
304
151
  if ((tag & 7) === 4 || tag === 0) {
305
152
  break;
@@ -310,83 +157,42 @@ export const GetUISubscriptionsByOrganizationNameResponse_Subscription = {
310
157
  },
311
158
  fromJSON(object) {
312
159
  return {
313
- id: isSet(object.id) ? globalThis.String(object.id) : "",
314
- name: isSet(object.name) ? globalThis.String(object.name) : "",
315
- description: isSet(object.description) ? globalThis.String(object.description) : "",
316
- events: globalThis.Array.isArray(object?.events) ? object.events.map((e) => firehoseEventFromJSON(e)) : [],
317
- subreddits: globalThis.Array.isArray(object?.subreddits)
318
- ? object.subreddits.map((e) => GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.fromJSON(e))
160
+ organization: isSet(object.organization) ? Organization.fromJSON(object.organization) : undefined,
161
+ subscriptions: globalThis.Array.isArray(object?.subscriptions)
162
+ ? object.subscriptions.map((e) => Subscription.fromJSON(e))
319
163
  : [],
320
- subredditRatings: globalThis.Array.isArray(object?.subredditRatings)
321
- ? object.subredditRatings.map((e) => subredditRatingFromJSON(e))
164
+ acccessTokens: globalThis.Array.isArray(object?.acccessTokens)
165
+ ? object.acccessTokens.map((e) => AccessToken.fromJSON(e))
322
166
  : [],
323
167
  };
324
168
  },
325
169
  toJSON(message) {
326
170
  const obj = {};
327
- if (message.id !== "") {
328
- obj.id = message.id;
329
- }
330
- if (message.name !== "") {
331
- obj.name = message.name;
332
- }
333
- if (message.description !== "") {
334
- obj.description = message.description;
171
+ if (message.organization !== undefined) {
172
+ obj.organization = Organization.toJSON(message.organization);
335
173
  }
336
- if (message.events?.length) {
337
- obj.events = message.events.map((e) => firehoseEventToJSON(e));
338
- }
339
- if (message.subreddits?.length) {
340
- obj.subreddits = message.subreddits.map((e) => GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.toJSON(e));
174
+ if (message.subscriptions?.length) {
175
+ obj.subscriptions = message.subscriptions.map((e) => Subscription.toJSON(e));
341
176
  }
342
- if (message.subredditRatings?.length) {
343
- obj.subredditRatings = message.subredditRatings.map((e) => subredditRatingToJSON(e));
177
+ if (message.acccessTokens?.length) {
178
+ obj.acccessTokens = message.acccessTokens.map((e) => AccessToken.toJSON(e));
344
179
  }
345
180
  return obj;
346
181
  },
347
182
  create(base) {
348
- return GetUISubscriptionsByOrganizationNameResponse_Subscription.fromPartial(base ?? {});
183
+ return UIGetOrganizationsResponse_HydratedOrganization.fromPartial(base ?? {});
349
184
  },
350
185
  fromPartial(object) {
351
- const message = createBaseGetUISubscriptionsByOrganizationNameResponse_Subscription();
352
- message.id = object.id ?? "";
353
- message.name = object.name ?? "";
354
- message.description = object.description ?? "";
355
- message.events = object.events?.map((e) => e) || [];
356
- message.subreddits =
357
- object.subreddits?.map((e) => GetUISubscriptionsByOrganizationNameResponse_SubredditInfo.fromPartial(e)) || [];
358
- message.subredditRatings = object.subredditRatings?.map((e) => e) || [];
186
+ const message = createBaseUIGetOrganizationsResponse_HydratedOrganization();
187
+ message.organization = (object.organization !== undefined && object.organization !== null)
188
+ ? Organization.fromPartial(object.organization)
189
+ : undefined;
190
+ message.subscriptions = object.subscriptions?.map((e) => Subscription.fromPartial(e)) || [];
191
+ message.acccessTokens = object.acccessTokens?.map((e) => AccessToken.fromPartial(e)) || [];
359
192
  return message;
360
193
  },
361
194
  };
362
- messageTypeRegistry.set(GetUISubscriptionsByOrganizationNameResponse_Subscription.$type, GetUISubscriptionsByOrganizationNameResponse_Subscription);
363
- export const ROAdminUIServiceName = "devvit.data.api.admin.v1alpha.ROAdminUI";
364
- export class ROAdminUIClientImpl {
365
- constructor(rpc, opts) {
366
- this.service = opts?.service || ROAdminUIServiceName;
367
- this.rpc = rpc;
368
- this.GetSubscriptionsByOrganizationName = this.GetSubscriptionsByOrganizationName.bind(this);
369
- }
370
- GetSubscriptionsByOrganizationName(request, metadata) {
371
- const data = GetUISubscriptionsByOrganizationNameRequest.encode(request).finish();
372
- const promise = this.rpc.request(this.service, "GetSubscriptionsByOrganizationName", data, metadata);
373
- return promise.then((data) => GetUISubscriptionsByOrganizationNameResponse.decode(_m0.Reader.create(data)));
374
- }
375
- }
376
- export const ROAdminUIDefinition = {
377
- name: "ROAdminUI",
378
- fullName: "devvit.data.api.admin.v1alpha.ROAdminUI",
379
- methods: {
380
- getSubscriptionsByOrganizationName: {
381
- name: "GetSubscriptionsByOrganizationName",
382
- requestType: GetUISubscriptionsByOrganizationNameRequest,
383
- requestStream: false,
384
- responseType: GetUISubscriptionsByOrganizationNameResponse,
385
- responseStream: false,
386
- options: {},
387
- },
388
- },
389
- };
195
+ messageTypeRegistry.set(UIGetOrganizationsResponse_HydratedOrganization.$type, UIGetOrganizationsResponse_HydratedOrganization);
390
196
  function isSet(value) {
391
197
  return value !== null && value !== undefined;
392
198
  }