@devvit/protos 0.10.23-next-2024-07-02-c8b9ec453.0 → 0.10.23-next-2024-07-23-7552e0bd4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +10 -4
- package/index.d.ts.map +1 -1
- package/index.js +8 -1
- package/meta.min.json +257 -155
- package/package.json +7 -7
- package/protos.min.js +2 -2
- package/protos.min.js.map +4 -4
- package/schema/devvit/data/api/v1alpha/delivery.proto +0 -11
- package/schema/devvit/dev_portal/app/app.proto +0 -7
- package/schema/devvit/dev_portal/app/info/app_info.proto +2 -3
- package/schema/devvit/plugin/assetresolver/assetresolver.proto +0 -2
- package/schema/devvit/plugin/buildpack/buildpack_common.proto +0 -10
- package/schema/devvit/plugin/redditapi/common/common_msg.proto +0 -18
- package/schema/devvit/plugin/redditapi/listings/listings_svc.proto +8 -4
- package/schema/devvit/plugin/redditapi/moderation/moderation_svc.proto +0 -17
- package/schema/devvit/reddit/v2alpha/postv2.proto +0 -4
- package/schema/devvit/reddit/v2alpha/userv2.proto +0 -1
- package/schema/devvit/runtime/bundle.proto +0 -9
- package/schema/devvit/ui/block_kit/v1beta/ui.proto +0 -3
- package/schema/devvit/ui/events/v1alpha/event.proto +4 -18
- package/types/devvit/actor/automation/v1alpha/event_handlers.d.ts +0 -80
- package/types/devvit/actor/automation/v1alpha/event_handlers.d.ts.map +1 -1
- package/types/devvit/dev_portal/app/app.d.ts +0 -6
- package/types/devvit/dev_portal/app/app.d.ts.map +1 -1
- package/types/devvit/dev_portal/app/app.js +1 -52
- package/types/devvit/dev_portal/app/info/app_info.d.ts +1 -2
- package/types/devvit/dev_portal/app/info/app_info.d.ts.map +1 -1
- package/types/devvit/dev_portal/app/info/app_info.js +0 -15
- package/types/devvit/dev_portal/dev_portal.d.ts +1 -59
- package/types/devvit/dev_portal/dev_portal.d.ts.map +1 -1
- package/types/devvit/gateway/resolvers.d.ts +0 -8
- package/types/devvit/gateway/resolvers.d.ts.map +1 -1
- package/types/devvit/gateway/v1alpha/triggers.d.ts +0 -168
- package/types/devvit/gateway/v1alpha/triggers.d.ts.map +1 -1
- package/types/devvit/plugin/assetresolver/assetresolver.d.ts +0 -2
- package/types/devvit/plugin/assetresolver/assetresolver.d.ts.map +1 -1
- package/types/devvit/plugin/assetresolver/assetresolver.js +2 -18
- package/types/devvit/plugin/buildpack/buildpack.d.ts +0 -16
- package/types/devvit/plugin/buildpack/buildpack.d.ts.map +1 -1
- package/types/devvit/plugin/buildpack/buildpack_common.d.ts +0 -23
- package/types/devvit/plugin/buildpack/buildpack_common.d.ts.map +1 -1
- package/types/devvit/plugin/buildpack/buildpack_common.js +1 -125
- package/types/devvit/plugin/linker/linker.d.ts +0 -8
- package/types/devvit/plugin/linker/linker.d.ts.map +1 -1
- package/types/devvit/plugin/linker/resolver.d.ts +0 -8
- package/types/devvit/plugin/linker/resolver.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/common/common_msg.d.ts +0 -20
- package/types/devvit/plugin/redditapi/common/common_msg.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/common/common_msg.js +1 -41
- package/types/devvit/plugin/redditapi/listings/listings_svc.d.ts +10 -6
- package/types/devvit/plugin/redditapi/listings/listings_svc.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/listings/listings_svc.js +326 -4
- package/types/devvit/plugin/redditapi/moderation/moderation_svc.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/moderation/moderation_svc.js +17 -146
- package/types/devvit/reddit/custom_post/v1alpha/custom_post.d.ts +8 -8
- package/types/devvit/reddit/v2alpha/postv2.d.ts +0 -3
- package/types/devvit/reddit/v2alpha/postv2.d.ts.map +1 -1
- package/types/devvit/reddit/v2alpha/postv2.js +0 -32
- package/types/devvit/reddit/v2alpha/userv2.d.ts +0 -1
- package/types/devvit/reddit/v2alpha/userv2.d.ts.map +1 -1
- package/types/devvit/reddit/v2alpha/userv2.js +0 -15
- package/types/devvit/runtime/actor/bootstrap.d.ts +0 -8
- package/types/devvit/runtime/actor/bootstrap.d.ts.map +1 -1
- package/types/devvit/runtime/actor/runtime.d.ts +0 -8
- package/types/devvit/runtime/actor/runtime.d.ts.map +1 -1
- package/types/devvit/runtime/actor/supervisor.d.ts +0 -8
- package/types/devvit/runtime/actor/supervisor.d.ts.map +1 -1
- package/types/devvit/runtime/bundle.d.ts +0 -25
- package/types/devvit/runtime/bundle.d.ts.map +1 -1
- package/types/devvit/runtime/bundle.js +0 -117
- package/types/devvit/service/bundle_service.d.ts +0 -16
- package/types/devvit/service/bundle_service.d.ts.map +1 -1
- package/types/devvit/ui/block_kit/v1beta/ui.d.ts +0 -3
- package/types/devvit/ui/block_kit/v1beta/ui.d.ts.map +1 -1
- package/types/devvit/ui/events/v1alpha/event.d.ts +5 -15
- package/types/devvit/ui/events/v1alpha/event.d.ts.map +1 -1
- package/types/devvit/ui/events/v1alpha/event.js +15 -58
- package/types/google/protobuf/descriptor.d.ts +7 -56
- package/types/google/protobuf/descriptor.d.ts.map +1 -1
- package/types/google/protobuf/descriptor.js +12 -179
- package/schema/devvit/actor/payments/v1alpha/payments.proto +0 -44
- package/schema/devvit/payments/v1alpha/common.proto +0 -13
- package/schema/devvit/payments/v1alpha/order.proto +0 -45
- package/schema/devvit/payments/v1alpha/product.proto +0 -38
- package/schema/devvit/plugin/payments/v1alpha/payments.proto +0 -62
- package/types/devvit/actor/payments/v1alpha/payments.d.ts +0 -168
- package/types/devvit/actor/payments/v1alpha/payments.d.ts.map +0 -1
- package/types/devvit/actor/payments/v1alpha/payments.js +0 -273
- package/types/devvit/payments/v1alpha/common.d.ts +0 -15
- package/types/devvit/payments/v1alpha/common.d.ts.map +0 -1
- package/types/devvit/payments/v1alpha/common.js +0 -44
- package/types/devvit/payments/v1alpha/order.d.ts +0 -50
- package/types/devvit/payments/v1alpha/order.d.ts.map +0 -1
- package/types/devvit/payments/v1alpha/order.js +0 -220
- package/types/devvit/payments/v1alpha/product.d.ts +0 -68
- package/types/devvit/payments/v1alpha/product.d.ts.map +0 -1
- package/types/devvit/payments/v1alpha/product.js +0 -300
- package/types/devvit/plugin/payments/v1alpha/payments.d.ts +0 -249
- package/types/devvit/plugin/payments/v1alpha/payments.d.ts.map +0 -1
- package/types/devvit/plugin/payments/v1alpha/payments.js +0 -673
@@ -1,220 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* #order.ts
|
3
|
-
*
|
4
|
-
* @packageDocumentation
|
5
|
-
*/
|
6
|
-
/* eslint-disable */
|
7
|
-
import _m0 from 'protobufjs/minimal.js';
|
8
|
-
import { Timestamp } from '../../../google/protobuf/timestamp.js';
|
9
|
-
import { messageTypeRegistry } from '../../../typeRegistry.js';
|
10
|
-
import { environmentFromJSON, environmentToJSON } from './common.js';
|
11
|
-
import { Product } from './product.js';
|
12
|
-
export var OrderStatus;
|
13
|
-
(function (OrderStatus) {
|
14
|
-
OrderStatus[OrderStatus["ORDER_STATUS_UNSPECIFIED"] = 0] = "ORDER_STATUS_UNSPECIFIED";
|
15
|
-
OrderStatus[OrderStatus["ORDER_STATUS_NEW"] = 1] = "ORDER_STATUS_NEW";
|
16
|
-
OrderStatus[OrderStatus["ORDER_STATUS_CREATED"] = 2] = "ORDER_STATUS_CREATED";
|
17
|
-
OrderStatus[OrderStatus["ORDER_STATUS_PAID"] = 3] = "ORDER_STATUS_PAID";
|
18
|
-
OrderStatus[OrderStatus["ORDER_STATUS_DELIVERED"] = 4] = "ORDER_STATUS_DELIVERED";
|
19
|
-
OrderStatus[OrderStatus["ORDER_STATUS_CANCELED"] = 5] = "ORDER_STATUS_CANCELED";
|
20
|
-
OrderStatus[OrderStatus["ORDER_STATUS_REVERTED"] = 6] = "ORDER_STATUS_REVERTED";
|
21
|
-
OrderStatus[OrderStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
22
|
-
})(OrderStatus || (OrderStatus = {}));
|
23
|
-
export function orderStatusFromJSON(object) {
|
24
|
-
switch (object) {
|
25
|
-
case 0:
|
26
|
-
case "ORDER_STATUS_UNSPECIFIED":
|
27
|
-
return OrderStatus.ORDER_STATUS_UNSPECIFIED;
|
28
|
-
case 1:
|
29
|
-
case "ORDER_STATUS_NEW":
|
30
|
-
return OrderStatus.ORDER_STATUS_NEW;
|
31
|
-
case 2:
|
32
|
-
case "ORDER_STATUS_CREATED":
|
33
|
-
return OrderStatus.ORDER_STATUS_CREATED;
|
34
|
-
case 3:
|
35
|
-
case "ORDER_STATUS_PAID":
|
36
|
-
return OrderStatus.ORDER_STATUS_PAID;
|
37
|
-
case 4:
|
38
|
-
case "ORDER_STATUS_DELIVERED":
|
39
|
-
return OrderStatus.ORDER_STATUS_DELIVERED;
|
40
|
-
case 5:
|
41
|
-
case "ORDER_STATUS_CANCELED":
|
42
|
-
return OrderStatus.ORDER_STATUS_CANCELED;
|
43
|
-
case 6:
|
44
|
-
case "ORDER_STATUS_REVERTED":
|
45
|
-
return OrderStatus.ORDER_STATUS_REVERTED;
|
46
|
-
case -1:
|
47
|
-
case "UNRECOGNIZED":
|
48
|
-
default:
|
49
|
-
return OrderStatus.UNRECOGNIZED;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
export function orderStatusToJSON(object) {
|
53
|
-
switch (object) {
|
54
|
-
case OrderStatus.ORDER_STATUS_UNSPECIFIED:
|
55
|
-
return 0;
|
56
|
-
case OrderStatus.ORDER_STATUS_NEW:
|
57
|
-
return 1;
|
58
|
-
case OrderStatus.ORDER_STATUS_CREATED:
|
59
|
-
return 2;
|
60
|
-
case OrderStatus.ORDER_STATUS_PAID:
|
61
|
-
return 3;
|
62
|
-
case OrderStatus.ORDER_STATUS_DELIVERED:
|
63
|
-
return 4;
|
64
|
-
case OrderStatus.ORDER_STATUS_CANCELED:
|
65
|
-
return 5;
|
66
|
-
case OrderStatus.ORDER_STATUS_REVERTED:
|
67
|
-
return 6;
|
68
|
-
case OrderStatus.UNRECOGNIZED:
|
69
|
-
default:
|
70
|
-
return -1;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
function createBaseOrder() {
|
74
|
-
return { id: "", status: 0, createdAt: undefined, updatedAt: undefined, products: [], environment: 0 };
|
75
|
-
}
|
76
|
-
export const Order = {
|
77
|
-
$type: "devvit.payments.v1alpha.Order",
|
78
|
-
encode(message, writer = _m0.Writer.create()) {
|
79
|
-
if (message.id !== "") {
|
80
|
-
writer.uint32(10).string(message.id);
|
81
|
-
}
|
82
|
-
if (message.status !== 0) {
|
83
|
-
writer.uint32(16).int32(message.status);
|
84
|
-
}
|
85
|
-
if (message.createdAt !== undefined) {
|
86
|
-
Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(26).fork()).ldelim();
|
87
|
-
}
|
88
|
-
if (message.updatedAt !== undefined) {
|
89
|
-
Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(34).fork()).ldelim();
|
90
|
-
}
|
91
|
-
for (const v of message.products) {
|
92
|
-
Product.encode(v, writer.uint32(42).fork()).ldelim();
|
93
|
-
}
|
94
|
-
if (message.environment !== 0) {
|
95
|
-
writer.uint32(64).int32(message.environment);
|
96
|
-
}
|
97
|
-
return writer;
|
98
|
-
},
|
99
|
-
decode(input, length) {
|
100
|
-
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
101
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
102
|
-
const message = createBaseOrder();
|
103
|
-
while (reader.pos < end) {
|
104
|
-
const tag = reader.uint32();
|
105
|
-
switch (tag >>> 3) {
|
106
|
-
case 1:
|
107
|
-
if (tag !== 10) {
|
108
|
-
break;
|
109
|
-
}
|
110
|
-
message.id = reader.string();
|
111
|
-
continue;
|
112
|
-
case 2:
|
113
|
-
if (tag !== 16) {
|
114
|
-
break;
|
115
|
-
}
|
116
|
-
message.status = reader.int32();
|
117
|
-
continue;
|
118
|
-
case 3:
|
119
|
-
if (tag !== 26) {
|
120
|
-
break;
|
121
|
-
}
|
122
|
-
message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
123
|
-
continue;
|
124
|
-
case 4:
|
125
|
-
if (tag !== 34) {
|
126
|
-
break;
|
127
|
-
}
|
128
|
-
message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
129
|
-
continue;
|
130
|
-
case 5:
|
131
|
-
if (tag !== 42) {
|
132
|
-
break;
|
133
|
-
}
|
134
|
-
message.products.push(Product.decode(reader, reader.uint32()));
|
135
|
-
continue;
|
136
|
-
case 8:
|
137
|
-
if (tag !== 64) {
|
138
|
-
break;
|
139
|
-
}
|
140
|
-
message.environment = reader.int32();
|
141
|
-
continue;
|
142
|
-
}
|
143
|
-
if ((tag & 7) === 4 || tag === 0) {
|
144
|
-
break;
|
145
|
-
}
|
146
|
-
reader.skipType(tag & 7);
|
147
|
-
}
|
148
|
-
return message;
|
149
|
-
},
|
150
|
-
fromJSON(object) {
|
151
|
-
return {
|
152
|
-
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
153
|
-
status: isSet(object.status) ? orderStatusFromJSON(object.status) : 0,
|
154
|
-
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
|
155
|
-
updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
|
156
|
-
products: globalThis.Array.isArray(object?.products) ? object.products.map((e) => Product.fromJSON(e)) : [],
|
157
|
-
environment: isSet(object.environment) ? environmentFromJSON(object.environment) : 0,
|
158
|
-
};
|
159
|
-
},
|
160
|
-
toJSON(message) {
|
161
|
-
const obj = {};
|
162
|
-
if (message.id !== "") {
|
163
|
-
obj.id = message.id;
|
164
|
-
}
|
165
|
-
if (message.status !== 0) {
|
166
|
-
obj.status = orderStatusToJSON(message.status);
|
167
|
-
}
|
168
|
-
if (message.createdAt !== undefined) {
|
169
|
-
obj.createdAt = message.createdAt.toISOString();
|
170
|
-
}
|
171
|
-
if (message.updatedAt !== undefined) {
|
172
|
-
obj.updatedAt = message.updatedAt.toISOString();
|
173
|
-
}
|
174
|
-
if (message.products?.length) {
|
175
|
-
obj.products = message.products.map((e) => Product.toJSON(e));
|
176
|
-
}
|
177
|
-
if (message.environment !== 0) {
|
178
|
-
obj.environment = environmentToJSON(message.environment);
|
179
|
-
}
|
180
|
-
return obj;
|
181
|
-
},
|
182
|
-
create(base) {
|
183
|
-
return Order.fromPartial(base ?? {});
|
184
|
-
},
|
185
|
-
fromPartial(object) {
|
186
|
-
const message = createBaseOrder();
|
187
|
-
message.id = object.id ?? "";
|
188
|
-
message.status = object.status ?? 0;
|
189
|
-
message.createdAt = object.createdAt ?? undefined;
|
190
|
-
message.updatedAt = object.updatedAt ?? undefined;
|
191
|
-
message.products = object.products?.map((e) => Product.fromPartial(e)) || [];
|
192
|
-
message.environment = object.environment ?? 0;
|
193
|
-
return message;
|
194
|
-
},
|
195
|
-
};
|
196
|
-
messageTypeRegistry.set(Order.$type, Order);
|
197
|
-
function toTimestamp(date) {
|
198
|
-
const seconds = Math.trunc(date.getTime() / 1000);
|
199
|
-
const nanos = (date.getTime() % 1000) * 1000000;
|
200
|
-
return { seconds, nanos };
|
201
|
-
}
|
202
|
-
function fromTimestamp(t) {
|
203
|
-
let millis = (t.seconds || 0) * 1000;
|
204
|
-
millis += (t.nanos || 0) / 1000000;
|
205
|
-
return new globalThis.Date(millis);
|
206
|
-
}
|
207
|
-
function fromJsonTimestamp(o) {
|
208
|
-
if (o instanceof globalThis.Date) {
|
209
|
-
return o;
|
210
|
-
}
|
211
|
-
else if (typeof o === "string") {
|
212
|
-
return new globalThis.Date(o);
|
213
|
-
}
|
214
|
-
else {
|
215
|
-
return fromTimestamp(Timestamp.fromJSON(o));
|
216
|
-
}
|
217
|
-
}
|
218
|
-
function isSet(value) {
|
219
|
-
return value !== null && value !== undefined;
|
220
|
-
}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* #product.ts
|
3
|
-
*
|
4
|
-
* @packageDocumentation
|
5
|
-
*/
|
6
|
-
import _m0 from 'protobufjs/minimal.js';
|
7
|
-
import { Environment } from './common.js';
|
8
|
-
export declare enum Currency {
|
9
|
-
CURRENCY_UNSPECIFIED = 0,
|
10
|
-
/** GOLD - Reddit internal currency */
|
11
|
-
GOLD = 200,
|
12
|
-
UNRECOGNIZED = -1
|
13
|
-
}
|
14
|
-
export declare function currencyFromJSON(object: any): Currency;
|
15
|
-
export declare function currencyToJSON(object: Currency): number;
|
16
|
-
export interface Product {
|
17
|
-
/** the developer defined identifer for the product */
|
18
|
-
sku: string;
|
19
|
-
/** the price of the product */
|
20
|
-
price?: ProductPrice | undefined;
|
21
|
-
/** whether or not this product is defined for sandbox or production purchases */
|
22
|
-
environment: Environment;
|
23
|
-
/** tags associated with the product */
|
24
|
-
productMetadata: {
|
25
|
-
[key: string]: string;
|
26
|
-
};
|
27
|
-
}
|
28
|
-
export interface Product_ProductMetadataEntry {
|
29
|
-
key: string;
|
30
|
-
value: string;
|
31
|
-
}
|
32
|
-
export interface ProductPrice {
|
33
|
-
amount: number;
|
34
|
-
currency: Currency;
|
35
|
-
}
|
36
|
-
export declare const Product: {
|
37
|
-
$type: "devvit.payments.v1alpha.Product";
|
38
|
-
encode(message: Product, writer?: _m0.Writer): _m0.Writer;
|
39
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): Product;
|
40
|
-
fromJSON(object: any): Product;
|
41
|
-
toJSON(message: Product): unknown;
|
42
|
-
create(base?: DeepPartial<Product>): Product;
|
43
|
-
fromPartial(object: DeepPartial<Product>): Product;
|
44
|
-
};
|
45
|
-
export declare const Product_ProductMetadataEntry: {
|
46
|
-
$type: "devvit.payments.v1alpha.Product.ProductMetadataEntry";
|
47
|
-
encode(message: Product_ProductMetadataEntry, writer?: _m0.Writer): _m0.Writer;
|
48
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): Product_ProductMetadataEntry;
|
49
|
-
fromJSON(object: any): Product_ProductMetadataEntry;
|
50
|
-
toJSON(message: Product_ProductMetadataEntry): unknown;
|
51
|
-
create(base?: DeepPartial<Product_ProductMetadataEntry>): Product_ProductMetadataEntry;
|
52
|
-
fromPartial(object: DeepPartial<Product_ProductMetadataEntry>): Product_ProductMetadataEntry;
|
53
|
-
};
|
54
|
-
export declare const ProductPrice: {
|
55
|
-
$type: "devvit.payments.v1alpha.ProductPrice";
|
56
|
-
encode(message: ProductPrice, writer?: _m0.Writer): _m0.Writer;
|
57
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): ProductPrice;
|
58
|
-
fromJSON(object: any): ProductPrice;
|
59
|
-
toJSON(message: ProductPrice): unknown;
|
60
|
-
create(base?: DeepPartial<ProductPrice>): ProductPrice;
|
61
|
-
fromPartial(object: DeepPartial<ProductPrice>): ProductPrice;
|
62
|
-
};
|
63
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
64
|
-
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
65
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
66
|
-
} : Partial<T>;
|
67
|
-
export {};
|
68
|
-
//# sourceMappingURL=product.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/payments/v1alpha/product.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,GAAG,MAAM,uBAAuB,CAAC;AAExC,OAAO,EAAE,WAAW,EAA0C,MAAM,aAAa,CAAC;AAElF,oBAAY,QAAQ;IAClB,oBAAoB,IAAI;IACxB,sCAAsC;IACtC,IAAI,MAAM;IACV,YAAY,KAAK;CAClB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,QAAQ,CAatD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAUvD;AAED,MAAM,WAAW,OAAO;IACtB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,KAAK,CAAC,EACF,YAAY,GACZ,SAAS,CAAC;IACd,iFAAiF;IACjF,WAAW,EAAE,WAAW,CAAC;IACzB,uCAAuC;IACvC,eAAe,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAMD,eAAO,MAAM,OAAO;;oBAGF,OAAO,WAAU,IAAI,MAAM,GAAyB,IAAI,MAAM;kBAgBhE,IAAI,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,OAAO;qBA+C/C,GAAG,GAAG,OAAO;oBAcd,OAAO,GAAG,OAAO;kBAuBnB,YAAY,OAAO,CAAC,GAAG,OAAO;wBAGxB,YAAY,OAAO,CAAC,GAAG,OAAO;CAkBnD,CAAC;AAQF,eAAO,MAAM,4BAA4B;;oBAGvB,4BAA4B,WAAU,IAAI,MAAM,GAAyB,IAAI,MAAM;kBAUrF,IAAI,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,4BAA4B;qBA8BpE,GAAG,GAAG,4BAA4B;oBAOnC,4BAA4B,GAAG,OAAO;kBAWxC,YAAY,4BAA4B,CAAC,GAAG,4BAA4B;wBAGlE,YAAY,4BAA4B,CAAC,GAAG,4BAA4B;CAM7F,CAAC;AAQF,eAAO,MAAM,YAAY;;oBAGP,YAAY,WAAU,IAAI,MAAM,GAAyB,IAAI,MAAM;kBAUrE,IAAI,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,YAAY;qBA8BpD,GAAG,GAAG,YAAY;oBAOnB,YAAY,GAAG,OAAO;kBAWxB,YAAY,YAAY,CAAC,GAAG,YAAY;wBAGlC,YAAY,YAAY,CAAC,GAAG,YAAY;CAM7D,CAAC;AAIF,KAAK,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpF,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,CAAC,GACvC,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACtE,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACrD,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
@@ -1,300 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* #product.ts
|
3
|
-
*
|
4
|
-
* @packageDocumentation
|
5
|
-
*/
|
6
|
-
/* eslint-disable */
|
7
|
-
import _m0 from 'protobufjs/minimal.js';
|
8
|
-
import { messageTypeRegistry } from '../../../typeRegistry.js';
|
9
|
-
import { environmentFromJSON, environmentToJSON } from './common.js';
|
10
|
-
export var Currency;
|
11
|
-
(function (Currency) {
|
12
|
-
Currency[Currency["CURRENCY_UNSPECIFIED"] = 0] = "CURRENCY_UNSPECIFIED";
|
13
|
-
/** GOLD - Reddit internal currency */
|
14
|
-
Currency[Currency["GOLD"] = 200] = "GOLD";
|
15
|
-
Currency[Currency["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
16
|
-
})(Currency || (Currency = {}));
|
17
|
-
export function currencyFromJSON(object) {
|
18
|
-
switch (object) {
|
19
|
-
case 0:
|
20
|
-
case "CURRENCY_UNSPECIFIED":
|
21
|
-
return Currency.CURRENCY_UNSPECIFIED;
|
22
|
-
case 200:
|
23
|
-
case "GOLD":
|
24
|
-
return Currency.GOLD;
|
25
|
-
case -1:
|
26
|
-
case "UNRECOGNIZED":
|
27
|
-
default:
|
28
|
-
return Currency.UNRECOGNIZED;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
export function currencyToJSON(object) {
|
32
|
-
switch (object) {
|
33
|
-
case Currency.CURRENCY_UNSPECIFIED:
|
34
|
-
return 0;
|
35
|
-
case Currency.GOLD:
|
36
|
-
return 200;
|
37
|
-
case Currency.UNRECOGNIZED:
|
38
|
-
default:
|
39
|
-
return -1;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
function createBaseProduct() {
|
43
|
-
return { sku: "", price: undefined, environment: 0, productMetadata: {} };
|
44
|
-
}
|
45
|
-
export const Product = {
|
46
|
-
$type: "devvit.payments.v1alpha.Product",
|
47
|
-
encode(message, writer = _m0.Writer.create()) {
|
48
|
-
if (message.sku !== "") {
|
49
|
-
writer.uint32(8010).string(message.sku);
|
50
|
-
}
|
51
|
-
if (message.price !== undefined) {
|
52
|
-
ProductPrice.encode(message.price, writer.uint32(42).fork()).ldelim();
|
53
|
-
}
|
54
|
-
if (message.environment !== 0) {
|
55
|
-
writer.uint32(160).int32(message.environment);
|
56
|
-
}
|
57
|
-
Object.entries(message.productMetadata).forEach(([key, value]) => {
|
58
|
-
Product_ProductMetadataEntry.encode({ key: key, value }, writer.uint32(8018).fork()).ldelim();
|
59
|
-
});
|
60
|
-
return writer;
|
61
|
-
},
|
62
|
-
decode(input, length) {
|
63
|
-
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
64
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
65
|
-
const message = createBaseProduct();
|
66
|
-
while (reader.pos < end) {
|
67
|
-
const tag = reader.uint32();
|
68
|
-
switch (tag >>> 3) {
|
69
|
-
case 1001:
|
70
|
-
if (tag !== 8010) {
|
71
|
-
break;
|
72
|
-
}
|
73
|
-
message.sku = reader.string();
|
74
|
-
continue;
|
75
|
-
case 5:
|
76
|
-
if (tag !== 42) {
|
77
|
-
break;
|
78
|
-
}
|
79
|
-
message.price = ProductPrice.decode(reader, reader.uint32());
|
80
|
-
continue;
|
81
|
-
case 20:
|
82
|
-
if (tag !== 160) {
|
83
|
-
break;
|
84
|
-
}
|
85
|
-
message.environment = reader.int32();
|
86
|
-
continue;
|
87
|
-
case 1002:
|
88
|
-
if (tag !== 8018) {
|
89
|
-
break;
|
90
|
-
}
|
91
|
-
const entry1002 = Product_ProductMetadataEntry.decode(reader, reader.uint32());
|
92
|
-
if (entry1002.value !== undefined) {
|
93
|
-
message.productMetadata[entry1002.key] = entry1002.value;
|
94
|
-
}
|
95
|
-
continue;
|
96
|
-
}
|
97
|
-
if ((tag & 7) === 4 || tag === 0) {
|
98
|
-
break;
|
99
|
-
}
|
100
|
-
reader.skipType(tag & 7);
|
101
|
-
}
|
102
|
-
return message;
|
103
|
-
},
|
104
|
-
fromJSON(object) {
|
105
|
-
return {
|
106
|
-
sku: isSet(object.sku) ? globalThis.String(object.sku) : "",
|
107
|
-
price: isSet(object.price) ? ProductPrice.fromJSON(object.price) : undefined,
|
108
|
-
environment: isSet(object.environment) ? environmentFromJSON(object.environment) : 0,
|
109
|
-
productMetadata: isObject(object.productMetadata)
|
110
|
-
? Object.entries(object.productMetadata).reduce((acc, [key, value]) => {
|
111
|
-
acc[key] = String(value);
|
112
|
-
return acc;
|
113
|
-
}, {})
|
114
|
-
: {},
|
115
|
-
};
|
116
|
-
},
|
117
|
-
toJSON(message) {
|
118
|
-
const obj = {};
|
119
|
-
if (message.sku !== "") {
|
120
|
-
obj.sku = message.sku;
|
121
|
-
}
|
122
|
-
if (message.price !== undefined) {
|
123
|
-
obj.price = ProductPrice.toJSON(message.price);
|
124
|
-
}
|
125
|
-
if (message.environment !== 0) {
|
126
|
-
obj.environment = environmentToJSON(message.environment);
|
127
|
-
}
|
128
|
-
if (message.productMetadata) {
|
129
|
-
const entries = Object.entries(message.productMetadata);
|
130
|
-
if (entries.length > 0) {
|
131
|
-
obj.productMetadata = {};
|
132
|
-
entries.forEach(([k, v]) => {
|
133
|
-
obj.productMetadata[k] = v;
|
134
|
-
});
|
135
|
-
}
|
136
|
-
}
|
137
|
-
return obj;
|
138
|
-
},
|
139
|
-
create(base) {
|
140
|
-
return Product.fromPartial(base ?? {});
|
141
|
-
},
|
142
|
-
fromPartial(object) {
|
143
|
-
const message = createBaseProduct();
|
144
|
-
message.sku = object.sku ?? "";
|
145
|
-
message.price = (object.price !== undefined && object.price !== null)
|
146
|
-
? ProductPrice.fromPartial(object.price)
|
147
|
-
: undefined;
|
148
|
-
message.environment = object.environment ?? 0;
|
149
|
-
message.productMetadata = Object.entries(object.productMetadata ?? {}).reduce((acc, [key, value]) => {
|
150
|
-
if (value !== undefined) {
|
151
|
-
acc[key] = globalThis.String(value);
|
152
|
-
}
|
153
|
-
return acc;
|
154
|
-
}, {});
|
155
|
-
return message;
|
156
|
-
},
|
157
|
-
};
|
158
|
-
messageTypeRegistry.set(Product.$type, Product);
|
159
|
-
function createBaseProduct_ProductMetadataEntry() {
|
160
|
-
return { key: "", value: "" };
|
161
|
-
}
|
162
|
-
export const Product_ProductMetadataEntry = {
|
163
|
-
$type: "devvit.payments.v1alpha.Product.ProductMetadataEntry",
|
164
|
-
encode(message, writer = _m0.Writer.create()) {
|
165
|
-
if (message.key !== "") {
|
166
|
-
writer.uint32(10).string(message.key);
|
167
|
-
}
|
168
|
-
if (message.value !== "") {
|
169
|
-
writer.uint32(18).string(message.value);
|
170
|
-
}
|
171
|
-
return writer;
|
172
|
-
},
|
173
|
-
decode(input, length) {
|
174
|
-
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
175
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
176
|
-
const message = createBaseProduct_ProductMetadataEntry();
|
177
|
-
while (reader.pos < end) {
|
178
|
-
const tag = reader.uint32();
|
179
|
-
switch (tag >>> 3) {
|
180
|
-
case 1:
|
181
|
-
if (tag !== 10) {
|
182
|
-
break;
|
183
|
-
}
|
184
|
-
message.key = reader.string();
|
185
|
-
continue;
|
186
|
-
case 2:
|
187
|
-
if (tag !== 18) {
|
188
|
-
break;
|
189
|
-
}
|
190
|
-
message.value = reader.string();
|
191
|
-
continue;
|
192
|
-
}
|
193
|
-
if ((tag & 7) === 4 || tag === 0) {
|
194
|
-
break;
|
195
|
-
}
|
196
|
-
reader.skipType(tag & 7);
|
197
|
-
}
|
198
|
-
return message;
|
199
|
-
},
|
200
|
-
fromJSON(object) {
|
201
|
-
return {
|
202
|
-
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
203
|
-
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
204
|
-
};
|
205
|
-
},
|
206
|
-
toJSON(message) {
|
207
|
-
const obj = {};
|
208
|
-
if (message.key !== "") {
|
209
|
-
obj.key = message.key;
|
210
|
-
}
|
211
|
-
if (message.value !== "") {
|
212
|
-
obj.value = message.value;
|
213
|
-
}
|
214
|
-
return obj;
|
215
|
-
},
|
216
|
-
create(base) {
|
217
|
-
return Product_ProductMetadataEntry.fromPartial(base ?? {});
|
218
|
-
},
|
219
|
-
fromPartial(object) {
|
220
|
-
const message = createBaseProduct_ProductMetadataEntry();
|
221
|
-
message.key = object.key ?? "";
|
222
|
-
message.value = object.value ?? "";
|
223
|
-
return message;
|
224
|
-
},
|
225
|
-
};
|
226
|
-
messageTypeRegistry.set(Product_ProductMetadataEntry.$type, Product_ProductMetadataEntry);
|
227
|
-
function createBaseProductPrice() {
|
228
|
-
return { amount: 0, currency: 0 };
|
229
|
-
}
|
230
|
-
export const ProductPrice = {
|
231
|
-
$type: "devvit.payments.v1alpha.ProductPrice",
|
232
|
-
encode(message, writer = _m0.Writer.create()) {
|
233
|
-
if (message.amount !== 0) {
|
234
|
-
writer.uint32(8).int32(message.amount);
|
235
|
-
}
|
236
|
-
if (message.currency !== 0) {
|
237
|
-
writer.uint32(16).int32(message.currency);
|
238
|
-
}
|
239
|
-
return writer;
|
240
|
-
},
|
241
|
-
decode(input, length) {
|
242
|
-
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
243
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
244
|
-
const message = createBaseProductPrice();
|
245
|
-
while (reader.pos < end) {
|
246
|
-
const tag = reader.uint32();
|
247
|
-
switch (tag >>> 3) {
|
248
|
-
case 1:
|
249
|
-
if (tag !== 8) {
|
250
|
-
break;
|
251
|
-
}
|
252
|
-
message.amount = reader.int32();
|
253
|
-
continue;
|
254
|
-
case 2:
|
255
|
-
if (tag !== 16) {
|
256
|
-
break;
|
257
|
-
}
|
258
|
-
message.currency = reader.int32();
|
259
|
-
continue;
|
260
|
-
}
|
261
|
-
if ((tag & 7) === 4 || tag === 0) {
|
262
|
-
break;
|
263
|
-
}
|
264
|
-
reader.skipType(tag & 7);
|
265
|
-
}
|
266
|
-
return message;
|
267
|
-
},
|
268
|
-
fromJSON(object) {
|
269
|
-
return {
|
270
|
-
amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0,
|
271
|
-
currency: isSet(object.currency) ? currencyFromJSON(object.currency) : 0,
|
272
|
-
};
|
273
|
-
},
|
274
|
-
toJSON(message) {
|
275
|
-
const obj = {};
|
276
|
-
if (message.amount !== 0) {
|
277
|
-
obj.amount = Math.round(message.amount);
|
278
|
-
}
|
279
|
-
if (message.currency !== 0) {
|
280
|
-
obj.currency = currencyToJSON(message.currency);
|
281
|
-
}
|
282
|
-
return obj;
|
283
|
-
},
|
284
|
-
create(base) {
|
285
|
-
return ProductPrice.fromPartial(base ?? {});
|
286
|
-
},
|
287
|
-
fromPartial(object) {
|
288
|
-
const message = createBaseProductPrice();
|
289
|
-
message.amount = object.amount ?? 0;
|
290
|
-
message.currency = object.currency ?? 0;
|
291
|
-
return message;
|
292
|
-
},
|
293
|
-
};
|
294
|
-
messageTypeRegistry.set(ProductPrice.$type, ProductPrice);
|
295
|
-
function isObject(value) {
|
296
|
-
return typeof value === "object" && value !== null;
|
297
|
-
}
|
298
|
-
function isSet(value) {
|
299
|
-
return value !== null && value !== undefined;
|
300
|
-
}
|