@devvit/protos 0.11.11-next-2025-03-13-4455a4ebd.0 → 0.11.11-next-2025-03-18-033164db5.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/twirp-server.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './types/devvit/dev_portal/waitlist/waitlist.twirp.js';
8
8
  export * from './types/devvit/plugin/logger/logger.twirp.js';
9
9
  export * from './types/devvit/plugin/settings/v1alpha/settings.twirp.js';
10
10
  export * from './types/devvit/remote_logger/remote_logger.twirp.js';
11
+ export * from './types/devvit/dev_portal/admin_portal.twirp.js';
11
12
  //# sourceMappingURL=twirp-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"twirp-server.d.ts","sourceRoot":"","sources":["../src/twirp-server.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,yDAAyD,CAAC;AACxE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iFAAiF,CAAC;AAChG,cAAc,0EAA0E,CAAC;AACzF,cAAc,yDAAyD,CAAC;AACxE,cAAc,sDAAsD,CAAC;AACrE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0DAA0D,CAAC;AACzE,cAAc,qDAAqD,CAAC"}
1
+ {"version":3,"file":"twirp-server.d.ts","sourceRoot":"","sources":["../src/twirp-server.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,yDAAyD,CAAC;AACxE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iFAAiF,CAAC;AAChG,cAAc,0EAA0E,CAAC;AACzF,cAAc,yDAAyD,CAAC;AACxE,cAAc,sDAAsD,CAAC;AACrE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0DAA0D,CAAC;AACzE,cAAc,qDAAqD,CAAC;AAGpE,cAAc,iDAAiD,CAAC"}
package/twirp-server.js CHANGED
@@ -8,3 +8,5 @@ export * from './types/devvit/dev_portal/waitlist/waitlist.twirp.js';
8
8
  export * from './types/devvit/plugin/logger/logger.twirp.js';
9
9
  export * from './types/devvit/plugin/settings/v1alpha/settings.twirp.js';
10
10
  export * from './types/devvit/remote_logger/remote_logger.twirp.js';
11
+ // admin
12
+ export * from './types/devvit/dev_portal/admin_portal.twirp.js';
@@ -0,0 +1,240 @@
1
+ /**
2
+ * #admin_portal.ts
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import _m0 from "protobufjs/minimal.js";
7
+ import { Metadata } from "../../../lib/Types.js";
8
+ import { FullInstallationInfo, InstallationUpgradeManyRequest, InstallationUpgradeManyResponse, InstallationUpgradeRequest } from "./installation/installation.js";
9
+ export interface AdminInstallation {
10
+ Upgrade(request: InstallationUpgradeRequest, metadata?: Metadata): Promise<FullInstallationInfo>;
11
+ UpgradeMany(request: InstallationUpgradeManyRequest, metadata?: Metadata): Promise<InstallationUpgradeManyResponse>;
12
+ }
13
+ export declare const AdminInstallationServiceName = "devvit.dev_portal.AdminInstallation";
14
+ export declare class AdminInstallationClientImpl implements AdminInstallation {
15
+ private readonly rpc;
16
+ private readonly service;
17
+ constructor(rpc: Rpc, opts?: {
18
+ service?: string;
19
+ });
20
+ Upgrade(request: InstallationUpgradeRequest, metadata?: Metadata): Promise<FullInstallationInfo>;
21
+ UpgradeMany(request: InstallationUpgradeManyRequest, metadata?: Metadata): Promise<InstallationUpgradeManyResponse>;
22
+ }
23
+ export type AdminInstallationDefinition = typeof AdminInstallationDefinition;
24
+ export declare const AdminInstallationDefinition: {
25
+ readonly name: "AdminInstallation";
26
+ readonly fullName: "devvit.dev_portal.AdminInstallation";
27
+ readonly methods: {
28
+ readonly upgrade: {
29
+ readonly name: "Upgrade";
30
+ readonly requestType: {
31
+ $type: "devvit.dev_portal.installation.InstallationUpgradeRequest";
32
+ encode(message: InstallationUpgradeRequest, writer?: _m0.Writer): _m0.Writer;
33
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): InstallationUpgradeRequest;
34
+ fromJSON(object: any): InstallationUpgradeRequest;
35
+ toJSON(message: InstallationUpgradeRequest): unknown;
36
+ create(base?: {
37
+ id?: string;
38
+ appVersionId?: string | undefined;
39
+ } | undefined): InstallationUpgradeRequest;
40
+ fromPartial(object: {
41
+ id?: string;
42
+ appVersionId?: string | undefined;
43
+ }): InstallationUpgradeRequest;
44
+ };
45
+ readonly requestStream: false;
46
+ readonly responseType: {
47
+ $type: "devvit.dev_portal.installation.FullInstallationInfo";
48
+ encode(message: FullInstallationInfo, writer?: _m0.Writer): _m0.Writer;
49
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): FullInstallationInfo;
50
+ fromJSON(object: any): FullInstallationInfo;
51
+ toJSON(message: FullInstallationInfo): unknown;
52
+ create(base?: {
53
+ installation?: {
54
+ id?: string;
55
+ upgradeStrategy?: import("./installation/installation.js").UpgradeStrategy;
56
+ upgradeStrategyConfig?: {
57
+ [x: string]: any;
58
+ } | undefined;
59
+ runAs?: string | undefined;
60
+ type?: import("./app_version/info/app_version_info.js").InstallationType;
61
+ location?: {
62
+ id?: string;
63
+ name?: string;
64
+ type?: import("../reddit/thing_type.js").ThingType;
65
+ icon?: string | undefined;
66
+ isNsfw?: boolean;
67
+ isUnavailable?: boolean;
68
+ } | undefined;
69
+ isEnabled?: boolean;
70
+ } | undefined;
71
+ appVersion?: {
72
+ id?: string;
73
+ visibility?: import("./app_version/info/app_version_info.js").VersionVisibility;
74
+ validInstallTypes?: import("./app_version/info/app_version_info.js").InstallationType[];
75
+ majorVersion?: number;
76
+ minorVersion?: number;
77
+ patchVersion?: number;
78
+ prereleaseVersion?: number | undefined;
79
+ uploadedAt?: Date | undefined;
80
+ buildStatus?: import("./app_version/info/app_version_info.js").BuildStatus;
81
+ builtAt?: Date | undefined;
82
+ about?: string;
83
+ hasCustomSettings?: boolean;
84
+ pool?: import("./app_version/info/app_version_info.js").ComputePool;
85
+ appCapabilities?: import("./nutrition/nutrition.js").NutritionCategory[];
86
+ } | undefined;
87
+ app?: {
88
+ id?: string;
89
+ slug?: string;
90
+ name?: string;
91
+ description?: string;
92
+ appAccount?: {
93
+ id?: string;
94
+ displayName?: string;
95
+ snoovatarIconUrl?: string;
96
+ } | undefined;
97
+ isNsfw?: boolean;
98
+ isDelisted?: boolean;
99
+ isFirstParty?: boolean;
100
+ isArchived?: boolean;
101
+ isWebviewEnabled?: boolean;
102
+ createdAt?: Date | undefined;
103
+ owner?: {
104
+ id?: string;
105
+ displayName?: string;
106
+ snoovatarIconUrl?: string;
107
+ } | undefined;
108
+ categories?: import("./app/categories/categories.js").Categories[];
109
+ stats?: {
110
+ installCount?: number;
111
+ versionsCount?: number;
112
+ } | undefined;
113
+ termsAndConditions?: string;
114
+ privacyPolicy?: string;
115
+ defaultPool?: import("./app_version/info/app_version_info.js").ComputePool;
116
+ isDisabled?: boolean;
117
+ minSubredditSizeRestrictionEnabled?: boolean;
118
+ } | undefined;
119
+ } | undefined): FullInstallationInfo;
120
+ fromPartial(object: {
121
+ installation?: {
122
+ id?: string;
123
+ upgradeStrategy?: import("./installation/installation.js").UpgradeStrategy;
124
+ upgradeStrategyConfig?: {
125
+ [x: string]: any;
126
+ } | undefined;
127
+ runAs?: string | undefined;
128
+ type?: import("./app_version/info/app_version_info.js").InstallationType;
129
+ location?: {
130
+ id?: string;
131
+ name?: string;
132
+ type?: import("../reddit/thing_type.js").ThingType;
133
+ icon?: string | undefined;
134
+ isNsfw?: boolean;
135
+ isUnavailable?: boolean;
136
+ } | undefined;
137
+ isEnabled?: boolean;
138
+ } | undefined;
139
+ appVersion?: {
140
+ id?: string;
141
+ visibility?: import("./app_version/info/app_version_info.js").VersionVisibility;
142
+ validInstallTypes?: import("./app_version/info/app_version_info.js").InstallationType[];
143
+ majorVersion?: number;
144
+ minorVersion?: number;
145
+ patchVersion?: number;
146
+ prereleaseVersion?: number | undefined;
147
+ uploadedAt?: Date | undefined;
148
+ buildStatus?: import("./app_version/info/app_version_info.js").BuildStatus;
149
+ builtAt?: Date | undefined;
150
+ about?: string;
151
+ hasCustomSettings?: boolean;
152
+ pool?: import("./app_version/info/app_version_info.js").ComputePool;
153
+ appCapabilities?: import("./nutrition/nutrition.js").NutritionCategory[];
154
+ } | undefined;
155
+ app?: {
156
+ id?: string;
157
+ slug?: string;
158
+ name?: string;
159
+ description?: string;
160
+ appAccount?: {
161
+ id?: string;
162
+ displayName?: string;
163
+ snoovatarIconUrl?: string;
164
+ } | undefined;
165
+ isNsfw?: boolean;
166
+ isDelisted?: boolean;
167
+ isFirstParty?: boolean;
168
+ isArchived?: boolean;
169
+ isWebviewEnabled?: boolean;
170
+ createdAt?: Date | undefined;
171
+ owner?: {
172
+ id?: string;
173
+ displayName?: string;
174
+ snoovatarIconUrl?: string;
175
+ } | undefined;
176
+ categories?: import("./app/categories/categories.js").Categories[];
177
+ stats?: {
178
+ installCount?: number;
179
+ versionsCount?: number;
180
+ } | undefined;
181
+ termsAndConditions?: string;
182
+ privacyPolicy?: string;
183
+ defaultPool?: import("./app_version/info/app_version_info.js").ComputePool;
184
+ isDisabled?: boolean;
185
+ minSubredditSizeRestrictionEnabled?: boolean;
186
+ } | undefined;
187
+ }): FullInstallationInfo;
188
+ };
189
+ readonly responseStream: false;
190
+ readonly options: {};
191
+ };
192
+ readonly upgradeMany: {
193
+ readonly name: "UpgradeMany";
194
+ readonly requestType: {
195
+ $type: "devvit.dev_portal.installation.InstallationUpgradeManyRequest";
196
+ encode(message: InstallationUpgradeManyRequest, writer?: _m0.Writer): _m0.Writer;
197
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): InstallationUpgradeManyRequest;
198
+ fromJSON(object: any): InstallationUpgradeManyRequest;
199
+ toJSON(message: InstallationUpgradeManyRequest): unknown;
200
+ create(base?: {
201
+ ids?: string[];
202
+ appVersionId?: string;
203
+ } | undefined): InstallationUpgradeManyRequest;
204
+ fromPartial(object: {
205
+ ids?: string[];
206
+ appVersionId?: string;
207
+ }): InstallationUpgradeManyRequest;
208
+ };
209
+ readonly requestStream: false;
210
+ readonly responseType: {
211
+ $type: "devvit.dev_portal.installation.InstallationUpgradeManyResponse";
212
+ encode(message: InstallationUpgradeManyResponse, writer?: _m0.Writer): _m0.Writer;
213
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): InstallationUpgradeManyResponse;
214
+ fromJSON(object: any): InstallationUpgradeManyResponse;
215
+ toJSON(message: InstallationUpgradeManyResponse): unknown;
216
+ create(base?: {
217
+ details?: {
218
+ id?: string;
219
+ success?: boolean;
220
+ error?: string | undefined;
221
+ }[];
222
+ } | undefined): InstallationUpgradeManyResponse;
223
+ fromPartial(object: {
224
+ details?: {
225
+ id?: string;
226
+ success?: boolean;
227
+ error?: string | undefined;
228
+ }[];
229
+ }): InstallationUpgradeManyResponse;
230
+ };
231
+ readonly responseStream: false;
232
+ readonly options: {};
233
+ };
234
+ };
235
+ };
236
+ interface Rpc {
237
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
238
+ }
239
+ export {};
240
+ //# sourceMappingURL=admin_portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin_portal.d.ts","sourceRoot":"","sources":["../../../../src/types/devvit/dev_portal/admin_portal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,GAAG,MAAM,uBAAuB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,OAAO,EAAE,0BAA0B,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjG,WAAW,CAAC,OAAO,EAAE,8BAA8B,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;CACrH;AAED,eAAO,MAAM,4BAA4B,wCAAwC,CAAC;AAClF,qBAAa,2BAA4B,YAAW,iBAAiB;IACnE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBACrB,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAMjD,OAAO,CAAC,OAAO,EAAE,0BAA0B,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAMhG,WAAW,CAAC,OAAO,EAAE,8BAA8B,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,+BAA+B,CAAC;CAKpH;AAED,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAC;AAC7E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAC;AAEX,UAAU,GAAG;IACX,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtG"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * #admin_portal.ts
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /* eslint-disable */
7
+ import _m0 from "protobufjs/minimal.js";
8
+ import { FullInstallationInfo, InstallationUpgradeManyRequest, InstallationUpgradeManyResponse, InstallationUpgradeRequest, } from "./installation/installation.js";
9
+ export const AdminInstallationServiceName = "devvit.dev_portal.AdminInstallation";
10
+ export class AdminInstallationClientImpl {
11
+ constructor(rpc, opts) {
12
+ this.service = opts?.service || AdminInstallationServiceName;
13
+ this.rpc = rpc;
14
+ this.Upgrade = this.Upgrade.bind(this);
15
+ this.UpgradeMany = this.UpgradeMany.bind(this);
16
+ }
17
+ Upgrade(request, metadata) {
18
+ const data = InstallationUpgradeRequest.encode(request).finish();
19
+ const promise = this.rpc.request(this.service, "Upgrade", data, metadata);
20
+ return promise.then((data) => FullInstallationInfo.decode(_m0.Reader.create(data)));
21
+ }
22
+ UpgradeMany(request, metadata) {
23
+ const data = InstallationUpgradeManyRequest.encode(request).finish();
24
+ const promise = this.rpc.request(this.service, "UpgradeMany", data, metadata);
25
+ return promise.then((data) => InstallationUpgradeManyResponse.decode(_m0.Reader.create(data)));
26
+ }
27
+ }
28
+ export const AdminInstallationDefinition = {
29
+ name: "AdminInstallation",
30
+ fullName: "devvit.dev_portal.AdminInstallation",
31
+ methods: {
32
+ upgrade: {
33
+ name: "Upgrade",
34
+ requestType: InstallationUpgradeRequest,
35
+ requestStream: false,
36
+ responseType: FullInstallationInfo,
37
+ responseStream: false,
38
+ options: {},
39
+ },
40
+ upgradeMany: {
41
+ name: "UpgradeMany",
42
+ requestType: InstallationUpgradeManyRequest,
43
+ requestStream: false,
44
+ responseType: InstallationUpgradeManyResponse,
45
+ responseStream: false,
46
+ options: {},
47
+ },
48
+ },
49
+ };
@@ -0,0 +1,22 @@
1
+ import { InstallationUpgradeRequest, FullInstallationInfo, InstallationUpgradeManyRequest, InstallationUpgradeManyResponse } from './installation/installation.js';
2
+ interface Rpc {
3
+ request(service: string, method: string, contentType: 'application/json' | 'application/protobuf', data: object | Uint8Array): Promise<object | Uint8Array>;
4
+ }
5
+ export interface AdminInstallationClient {
6
+ Upgrade(request: InstallationUpgradeRequest): Promise<FullInstallationInfo>;
7
+ UpgradeMany(request: InstallationUpgradeManyRequest): Promise<InstallationUpgradeManyResponse>;
8
+ }
9
+ export declare class AdminInstallationClientJSON implements AdminInstallationClient {
10
+ private readonly rpc;
11
+ constructor(rpc: Rpc);
12
+ Upgrade(request: InstallationUpgradeRequest): Promise<FullInstallationInfo>;
13
+ UpgradeMany(request: InstallationUpgradeManyRequest): Promise<InstallationUpgradeManyResponse>;
14
+ }
15
+ export declare class AdminInstallationClientProtobuf implements AdminInstallationClient {
16
+ private readonly rpc;
17
+ constructor(rpc: Rpc);
18
+ Upgrade(request: InstallationUpgradeRequest): Promise<FullInstallationInfo>;
19
+ UpgradeMany(request: InstallationUpgradeManyRequest): Promise<InstallationUpgradeManyResponse>;
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=admin_portal.twirp-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin_portal.twirp-client.d.ts","sourceRoot":"","sources":["../../../../src/types/devvit/dev_portal/admin_portal.twirp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,gCAAgC,CAAC;AAMxC,UAAU,GAAG;IACX,OAAO,CACL,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,GAAG,sBAAsB,EACxD,IAAI,EAAE,MAAM,GAAG,UAAU,GACxB,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC5E,WAAW,CACT,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAAC;CAC7C;AAED,qBAAa,2BAA4B,YAAW,uBAAuB;IACzE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBACd,GAAG,EAAE,GAAG;IAKpB,OAAO,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAW3E,WAAW,CACT,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,CAAC;CAY5C;AAED,qBAAa,+BACX,YAAW,uBAAuB;IAElC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBACd,GAAG,EAAE,GAAG;IAKpB,OAAO,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAa3E,WAAW,CACT,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,CAAC;CAY5C"}
@@ -0,0 +1,35 @@
1
+ import { InstallationUpgradeRequest, FullInstallationInfo, InstallationUpgradeManyRequest, InstallationUpgradeManyResponse, } from './installation/installation.js';
2
+ export class AdminInstallationClientJSON {
3
+ constructor(rpc) {
4
+ this.rpc = rpc;
5
+ this.Upgrade.bind(this);
6
+ this.UpgradeMany.bind(this);
7
+ }
8
+ Upgrade(request) {
9
+ const data = InstallationUpgradeRequest.toJSON(request);
10
+ const promise = this.rpc.request('devvit.dev_portal.AdminInstallation', 'Upgrade', 'application/json', data);
11
+ return promise.then((data) => FullInstallationInfo.fromJSON(data));
12
+ }
13
+ UpgradeMany(request) {
14
+ const data = InstallationUpgradeManyRequest.toJSON(request);
15
+ const promise = this.rpc.request('devvit.dev_portal.AdminInstallation', 'UpgradeMany', 'application/json', data);
16
+ return promise.then((data) => InstallationUpgradeManyResponse.fromJSON(data));
17
+ }
18
+ }
19
+ export class AdminInstallationClientProtobuf {
20
+ constructor(rpc) {
21
+ this.rpc = rpc;
22
+ this.Upgrade.bind(this);
23
+ this.UpgradeMany.bind(this);
24
+ }
25
+ Upgrade(request) {
26
+ const data = InstallationUpgradeRequest.encode(request).finish();
27
+ const promise = this.rpc.request('devvit.dev_portal.AdminInstallation', 'Upgrade', 'application/protobuf', data);
28
+ return promise.then((data) => FullInstallationInfo.decode(data));
29
+ }
30
+ UpgradeMany(request) {
31
+ const data = InstallationUpgradeManyRequest.encode(request).finish();
32
+ const promise = this.rpc.request('devvit.dev_portal.AdminInstallation', 'UpgradeMany', 'application/protobuf', data);
33
+ return promise.then((data) => InstallationUpgradeManyResponse.decode(data));
34
+ }
35
+ }
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { TwirpContext, TwirpServer } from 'twirp-ts';
3
+ import { InstallationUpgradeRequest, FullInstallationInfo, InstallationUpgradeManyRequest, InstallationUpgradeManyResponse } from './installation/installation.js';
4
+ export interface AdminInstallationTwirp<T extends TwirpContext = TwirpContext> {
5
+ Upgrade(ctx: T, request: InstallationUpgradeRequest): Promise<FullInstallationInfo>;
6
+ UpgradeMany(ctx: T, request: InstallationUpgradeManyRequest): Promise<InstallationUpgradeManyResponse>;
7
+ }
8
+ export declare enum AdminInstallationMethod {
9
+ Upgrade = "Upgrade",
10
+ UpgradeMany = "UpgradeMany"
11
+ }
12
+ export declare const AdminInstallationMethodList: AdminInstallationMethod[];
13
+ export declare function createAdminInstallationServer<T extends TwirpContext = TwirpContext>(service: AdminInstallationTwirp<T>): TwirpServer<AdminInstallationTwirp<TwirpContext<import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>>>, T>;
14
+ //# sourceMappingURL=admin_portal.twirp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin_portal.twirp.d.ts","sourceRoot":"","sources":["../../../../src/types/devvit/dev_portal/admin_portal.twirp.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAOZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,gCAAgC,CAAC;AAMxC,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IAC3E,OAAO,CACL,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,WAAW,CACT,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAAC;CAC7C;AAED,oBAAY,uBAAuB;IACjC,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,2BAA2B,2BAGvC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,YAAY,GAAG,YAAY,EACrC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,uJAQnC"}
@@ -0,0 +1,156 @@
1
+ import { TwirpServer, TwirpError, TwirpErrorCode, TwirpContentType, chainInterceptors, } from 'twirp-ts';
2
+ import { InstallationUpgradeRequest, FullInstallationInfo, InstallationUpgradeManyRequest, InstallationUpgradeManyResponse, } from './installation/installation.js';
3
+ export var AdminInstallationMethod;
4
+ (function (AdminInstallationMethod) {
5
+ AdminInstallationMethod["Upgrade"] = "Upgrade";
6
+ AdminInstallationMethod["UpgradeMany"] = "UpgradeMany";
7
+ })(AdminInstallationMethod || (AdminInstallationMethod = {}));
8
+ export const AdminInstallationMethodList = [
9
+ AdminInstallationMethod.Upgrade,
10
+ AdminInstallationMethod.UpgradeMany,
11
+ ];
12
+ export function createAdminInstallationServer(service) {
13
+ return new TwirpServer({
14
+ service,
15
+ packageName: 'devvit.dev_portal',
16
+ serviceName: 'AdminInstallation',
17
+ methodList: AdminInstallationMethodList,
18
+ matchRoute: matchAdminInstallationRoute,
19
+ });
20
+ }
21
+ function matchAdminInstallationRoute(method, events) {
22
+ switch (method) {
23
+ case 'Upgrade':
24
+ return async (ctx, service, data, interceptors) => {
25
+ ctx = { ...ctx, methodName: 'Upgrade' };
26
+ await events.onMatch(ctx);
27
+ return handleAdminInstallationUpgradeRequest(ctx, service, data, interceptors);
28
+ };
29
+ case 'UpgradeMany':
30
+ return async (ctx, service, data, interceptors) => {
31
+ ctx = { ...ctx, methodName: 'UpgradeMany' };
32
+ await events.onMatch(ctx);
33
+ return handleAdminInstallationUpgradeManyRequest(ctx, service, data, interceptors);
34
+ };
35
+ default:
36
+ events.onNotFound();
37
+ const msg = `no handler found`;
38
+ throw new TwirpError(TwirpErrorCode.BadRoute, msg);
39
+ }
40
+ }
41
+ function handleAdminInstallationUpgradeRequest(ctx, service, data, interceptors) {
42
+ switch (ctx.contentType) {
43
+ case TwirpContentType.JSON:
44
+ return handleAdminInstallationUpgradeJSON(ctx, service, data, interceptors);
45
+ case TwirpContentType.Protobuf:
46
+ return handleAdminInstallationUpgradeProtobuf(ctx, service, data, interceptors);
47
+ default:
48
+ const msg = 'unexpected Content-Type';
49
+ throw new TwirpError(TwirpErrorCode.BadRoute, msg);
50
+ }
51
+ }
52
+ function handleAdminInstallationUpgradeManyRequest(ctx, service, data, interceptors) {
53
+ switch (ctx.contentType) {
54
+ case TwirpContentType.JSON:
55
+ return handleAdminInstallationUpgradeManyJSON(ctx, service, data, interceptors);
56
+ case TwirpContentType.Protobuf:
57
+ return handleAdminInstallationUpgradeManyProtobuf(ctx, service, data, interceptors);
58
+ default:
59
+ const msg = 'unexpected Content-Type';
60
+ throw new TwirpError(TwirpErrorCode.BadRoute, msg);
61
+ }
62
+ }
63
+ async function handleAdminInstallationUpgradeJSON(ctx, service, data, interceptors) {
64
+ let request;
65
+ let response;
66
+ try {
67
+ const body = JSON.parse(data.toString() || '{}');
68
+ request = InstallationUpgradeRequest.fromJSON(body);
69
+ }
70
+ catch (e) {
71
+ if (e instanceof Error) {
72
+ const msg = 'the json request could not be decoded';
73
+ throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
74
+ }
75
+ }
76
+ if (interceptors && interceptors.length > 0) {
77
+ const interceptor = chainInterceptors(...interceptors);
78
+ response = await interceptor(ctx, request, (ctx, inputReq) => {
79
+ return service.Upgrade(ctx, inputReq);
80
+ });
81
+ }
82
+ else {
83
+ response = await service.Upgrade(ctx, request);
84
+ }
85
+ return JSON.stringify(FullInstallationInfo.toJSON(response));
86
+ }
87
+ async function handleAdminInstallationUpgradeManyJSON(ctx, service, data, interceptors) {
88
+ let request;
89
+ let response;
90
+ try {
91
+ const body = JSON.parse(data.toString() || '{}');
92
+ request = InstallationUpgradeManyRequest.fromJSON(body);
93
+ }
94
+ catch (e) {
95
+ if (e instanceof Error) {
96
+ const msg = 'the json request could not be decoded';
97
+ throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
98
+ }
99
+ }
100
+ if (interceptors && interceptors.length > 0) {
101
+ const interceptor = chainInterceptors(...interceptors);
102
+ response = await interceptor(ctx, request, (ctx, inputReq) => {
103
+ return service.UpgradeMany(ctx, inputReq);
104
+ });
105
+ }
106
+ else {
107
+ response = await service.UpgradeMany(ctx, request);
108
+ }
109
+ return JSON.stringify(InstallationUpgradeManyResponse.toJSON(response));
110
+ }
111
+ async function handleAdminInstallationUpgradeProtobuf(ctx, service, data, interceptors) {
112
+ let request;
113
+ let response;
114
+ try {
115
+ request = InstallationUpgradeRequest.decode(data);
116
+ }
117
+ catch (e) {
118
+ if (e instanceof Error) {
119
+ const msg = 'the protobuf request could not be decoded';
120
+ throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
121
+ }
122
+ }
123
+ if (interceptors && interceptors.length > 0) {
124
+ const interceptor = chainInterceptors(...interceptors);
125
+ response = await interceptor(ctx, request, (ctx, inputReq) => {
126
+ return service.Upgrade(ctx, inputReq);
127
+ });
128
+ }
129
+ else {
130
+ response = await service.Upgrade(ctx, request);
131
+ }
132
+ return Buffer.from(FullInstallationInfo.encode(response).finish());
133
+ }
134
+ async function handleAdminInstallationUpgradeManyProtobuf(ctx, service, data, interceptors) {
135
+ let request;
136
+ let response;
137
+ try {
138
+ request = InstallationUpgradeManyRequest.decode(data);
139
+ }
140
+ catch (e) {
141
+ if (e instanceof Error) {
142
+ const msg = 'the protobuf request could not be decoded';
143
+ throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
144
+ }
145
+ }
146
+ if (interceptors && interceptors.length > 0) {
147
+ const interceptor = chainInterceptors(...interceptors);
148
+ response = await interceptor(ctx, request, (ctx, inputReq) => {
149
+ return service.UpgradeMany(ctx, inputReq);
150
+ });
151
+ }
152
+ else {
153
+ response = await service.UpgradeMany(ctx, request);
154
+ }
155
+ return Buffer.from(InstallationUpgradeManyResponse.encode(response).finish());
156
+ }