@daocloud-proto/leopard 0.18.0-dev2 → 0.18.0-dev4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/leopard",
3
- "version":"0.18.0-dev2",
3
+ "version":"0.18.0-dev4",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"
@@ -344,18 +344,22 @@ export type DeleteSpecInfoRequest = {
344
344
  export type DeleteSpecInfoResponse = {
345
345
  }
346
346
 
347
+ export type IntBound = {
348
+ value?: number
349
+ }
350
+
347
351
  export type SpecFieldKey = {
348
352
  id?: number
349
353
  key?: string
350
354
  keyI18N?: {[key: string]: string}
351
- "x-visible"?: {[key: string]: string}
355
+ xVisible?: {[key: string]: string}
352
356
  unit?: string
353
357
  unitBase?: number
354
358
  required?: boolean
355
359
  options?: string[]
356
360
  valueType?: string
357
- min?: number | null
358
- max?: number | null
361
+ min?: IntBound
362
+ max?: IntBound
359
363
  }
360
364
 
361
365
  export type ProductSpecFieldKeys = {
@@ -418,6 +422,7 @@ export type CreateSKUInfoRequest = {
418
422
  available?: boolean
419
423
  displayOrder?: number
420
424
  discountRuleId?: string
425
+ paymentPolicy?: SkuPaymentPolicy
421
426
  }
422
427
 
423
428
  export type CreateSKUInfoResponse = {
@@ -6,10 +6,21 @@
6
6
 
7
7
  import * as fm from "../fetch.pb"
8
8
 
9
+ type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
10
+ type OneOf<T> =
11
+ | { [k in keyof T]?: undefined }
12
+ | (
13
+ keyof T extends infer K ?
14
+ (K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K>
15
+ : never)
16
+ : never);
17
+
9
18
  export enum VoucherStatus {
10
19
  Active = "Active",
11
20
  UsedUp = "UsedUp",
12
21
  Expired = "Expired",
22
+ Unactivated = "Unactivated",
23
+ Suspended = "Suspended",
13
24
  }
14
25
 
15
26
  export type BatchCreateVouchersRequest = {
@@ -20,6 +31,8 @@ export type BatchCreateVouchersRequest = {
20
31
  regions?: string[]
21
32
  expireTimestamp?: string
22
33
  products?: string[]
34
+ skuIds?: string[]
35
+ voucherGroupId?: number
23
36
  }
24
37
 
25
38
  export type BatchCreateVouchersResponse = {
@@ -73,6 +86,9 @@ export type VoucherInfo = {
73
86
  orderTypes?: string[]
74
87
  effectTimestamp?: string
75
88
  expireTimestamp?: string
89
+ skuIds?: string[]
90
+ voucherGroupId?: number
91
+ suspendedAt?: string
76
92
  }
77
93
 
78
94
  export type VoucherListInfo = {
@@ -92,6 +108,9 @@ export type VoucherListInfo = {
92
108
  createdAt?: string
93
109
  createUserId?: string
94
110
  createUsername?: string
111
+ skuIds?: string[]
112
+ voucherGroupId?: number
113
+ suspendedAt?: string
95
114
  }
96
115
 
97
116
  export type ActivateVoucherRequest = {
@@ -123,11 +142,113 @@ export type BatchCreateAndActiveVouchersRequest = {
123
142
  regions?: string[]
124
143
  expireTimestamp?: string
125
144
  products?: string[]
145
+ skuIds?: string[]
146
+ voucherGroupId?: number
126
147
  }
127
148
 
128
149
  export type BatchCreateAndActiveVouchersResponse = {
129
150
  }
130
151
 
152
+ export type CreateVoucherGroupRequest = {
153
+ name?: string
154
+ totalAmount?: string
155
+ effectiveDays?: number
156
+ expireTimestamp?: string
157
+ regions?: string[]
158
+ products?: string[]
159
+ skuIds?: string[]
160
+ quantity?: number
161
+ enableRedeemCode?: boolean
162
+ }
163
+
164
+ export type CreateVoucherGroupResponse = {
165
+ groupId?: number
166
+ redeemCode?: string
167
+ voucherIds?: string[]
168
+ }
169
+
170
+ export type AddVouchersToGroupRequest = {
171
+ groupId?: number
172
+ quantity?: number
173
+ }
174
+
175
+ export type AddVouchersToGroupResponse = {
176
+ voucherIds?: string[]
177
+ }
178
+
179
+ export type ListVoucherGroupsRequest = {
180
+ name?: string
181
+ page?: number
182
+ pageSize?: number
183
+ }
184
+
185
+ export type VoucherGroupInfo = {
186
+ groupId?: number
187
+ name?: string
188
+ redeemCode?: string
189
+ totalAmount?: string
190
+ effectiveDays?: number
191
+ expireTimestamp?: string
192
+ regions?: string[]
193
+ products?: string[]
194
+ skuIds?: string[]
195
+ voucherCount?: string
196
+ activatedCount?: string
197
+ unactivatedCount?: string
198
+ createdAt?: string
199
+ }
200
+
201
+ export type ListVoucherGroupsResponse = {
202
+ items?: VoucherGroupInfo[]
203
+ pagination?: Pagination
204
+ }
205
+
206
+ export type ListVouchersByGroupRequest = {
207
+ groupId?: number
208
+ voucherId?: string
209
+ userId?: string
210
+ status?: string
211
+ page?: number
212
+ pageSize?: number
213
+ }
214
+
215
+ export type DeleteVoucherGroupRequest = {
216
+ groupId?: number
217
+ }
218
+
219
+ export type DeleteVoucherGroupResponse = {
220
+ }
221
+
222
+ export type ActivateVoucherFromGroupRequest = {
223
+ groupId?: number
224
+ userId?: string
225
+ }
226
+
227
+
228
+ type BaseRedeemVoucherRequest = {
229
+ }
230
+
231
+ export type RedeemVoucherRequest = BaseRedeemVoucherRequest
232
+ & OneOf<{ redeemCode: string; voucherId: string }>
233
+
234
+ export type RedeemVoucherResponse = {
235
+ voucherId?: string
236
+ }
237
+
238
+ export type SuspendVoucherRequest = {
239
+ voucherId?: string
240
+ }
241
+
242
+ export type SuspendVoucherResponse = {
243
+ }
244
+
245
+ export type ResumeVoucherRequest = {
246
+ voucherId?: string
247
+ }
248
+
249
+ export type ResumeVoucherResponse = {
250
+ }
251
+
131
252
  export class Voucher {
132
253
  static BatchCreateVouchers(req: BatchCreateVouchersRequest, initReq?: fm.InitReq): Promise<BatchCreateVouchersResponse> {
133
254
  return fm.fetchReq<BatchCreateVouchersRequest, BatchCreateVouchersResponse>(`/apis/leopard.io/v1alpha1/vouchers/batch-create`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
@@ -153,4 +274,31 @@ export class Voucher {
153
274
  static GetVoucherStatByCurrentUser(req: GetVoucherStatByCurrentUserRequest, initReq?: fm.InitReq): Promise<GetVoucherStatByCurrentUserResponse> {
154
275
  return fm.fetchReq<GetVoucherStatByCurrentUserRequest, GetVoucherStatByCurrentUserResponse>(`/apis/leopard.io/v1alpha1/vouchers/stat?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
155
276
  }
277
+ static CreateVoucherGroup(req: CreateVoucherGroupRequest, initReq?: fm.InitReq): Promise<CreateVoucherGroupResponse> {
278
+ return fm.fetchReq<CreateVoucherGroupRequest, CreateVoucherGroupResponse>(`/apis/leopard.io/v1alpha1/voucher-groups`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
279
+ }
280
+ static AddVouchersToGroup(req: AddVouchersToGroupRequest, initReq?: fm.InitReq): Promise<AddVouchersToGroupResponse> {
281
+ return fm.fetchReq<AddVouchersToGroupRequest, AddVouchersToGroupResponse>(`/apis/leopard.io/v1alpha1/voucher-groups/${req["groupId"]}/vouchers`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
282
+ }
283
+ static ListVoucherGroups(req: ListVoucherGroupsRequest, initReq?: fm.InitReq): Promise<ListVoucherGroupsResponse> {
284
+ return fm.fetchReq<ListVoucherGroupsRequest, ListVoucherGroupsResponse>(`/apis/leopard.io/v1alpha1/voucher-groups?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
285
+ }
286
+ static ListVouchersByGroup(req: ListVouchersByGroupRequest, initReq?: fm.InitReq): Promise<ListAllVouchersResponse> {
287
+ return fm.fetchReq<ListVouchersByGroupRequest, ListAllVouchersResponse>(`/apis/leopard.io/v1alpha1/voucher-groups/${req["groupId"]}/vouchers?${fm.renderURLSearchParams(req, ["groupId"])}`, {...initReq, method: "GET"})
288
+ }
289
+ static DeleteVoucherGroup(req: DeleteVoucherGroupRequest, initReq?: fm.InitReq): Promise<DeleteVoucherGroupResponse> {
290
+ return fm.fetchReq<DeleteVoucherGroupRequest, DeleteVoucherGroupResponse>(`/apis/leopard.io/v1alpha1/voucher-groups/${req["groupId"]}`, {...initReq, method: "DELETE"})
291
+ }
292
+ static ActivateVoucherFromGroup(req: ActivateVoucherFromGroupRequest, initReq?: fm.InitReq): Promise<RedeemVoucherResponse> {
293
+ return fm.fetchReq<ActivateVoucherFromGroupRequest, RedeemVoucherResponse>(`/apis/leopard.io/v1alpha1/voucher-groups/${req["groupId"]}/activate-for-user`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
294
+ }
295
+ static RedeemVoucher(req: RedeemVoucherRequest, initReq?: fm.InitReq): Promise<RedeemVoucherResponse> {
296
+ return fm.fetchReq<RedeemVoucherRequest, RedeemVoucherResponse>(`/apis/leopard.io/v1alpha1/vouchers/redeem`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
297
+ }
298
+ static SuspendVoucher(req: SuspendVoucherRequest, initReq?: fm.InitReq): Promise<SuspendVoucherResponse> {
299
+ return fm.fetchReq<SuspendVoucherRequest, SuspendVoucherResponse>(`/apis/leopard.io/v1alpha1/vouchers/${req["voucherId"]}/suspend`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
300
+ }
301
+ static ResumeVoucher(req: ResumeVoucherRequest, initReq?: fm.InitReq): Promise<ResumeVoucherResponse> {
302
+ return fm.fetchReq<ResumeVoucherRequest, ResumeVoucherResponse>(`/apis/leopard.io/v1alpha1/vouchers/${req["voucherId"]}/resume`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
303
+ }
156
304
  }