@daocloud-proto/leopard 0.18.0-dev6 → 0.18.0-rc1

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-dev6",
3
+ "version":"0.18.0-rc1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"
@@ -6,15 +6,6 @@
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
-
18
9
  export enum VoucherStatus {
19
10
  Active = "Active",
20
11
  UsedUp = "UsedUp",
@@ -111,6 +102,7 @@ export type VoucherListInfo = {
111
102
  skuIds?: string[]
112
103
  voucherGroupId?: number
113
104
  suspendedAt?: string
105
+ voucherGroup?: VoucherGroupSummary
114
106
  }
115
107
 
116
108
  export type ActivateVoucherRequest = {
@@ -224,13 +216,10 @@ export type ActivateVoucherFromGroupRequest = {
224
216
  userId?: string
225
217
  }
226
218
 
227
-
228
- type BaseRedeemVoucherRequest = {
219
+ export type RedeemVoucherRequest = {
220
+ code?: string
229
221
  }
230
222
 
231
- export type RedeemVoucherRequest = BaseRedeemVoucherRequest
232
- & OneOf<{ redeemCode: string; voucherId: string }>
233
-
234
223
  export type RedeemVoucherResponse = {
235
224
  voucherId?: string
236
225
  }
@@ -249,6 +238,11 @@ export type ResumeVoucherRequest = {
249
238
  export type ResumeVoucherResponse = {
250
239
  }
251
240
 
241
+ export type VoucherGroupSummary = {
242
+ groupId?: number
243
+ name?: string
244
+ }
245
+
252
246
  export class Voucher {
253
247
  static BatchCreateVouchers(req: BatchCreateVouchersRequest, initReq?: fm.InitReq): Promise<BatchCreateVouchersResponse> {
254
248
  return fm.fetchReq<BatchCreateVouchersRequest, BatchCreateVouchersResponse>(`/apis/leopard.io/v1alpha1/vouchers/batch-create`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})