@daocloud-proto/leopard 0.1.0-dev12 → 0.1.0-dev14

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.1.0-dev12",
3
+ "version":"0.1.0-dev14",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"
@@ -17,8 +17,8 @@ export enum UnitType {
17
17
  COMPUTE_UNIT = "COMPUTE_UNIT",
18
18
  }
19
19
 
20
- export enum Currency {
21
- CNY = "CNY",
20
+ export enum QuantityUnit {
21
+ EMPTY = "EMPTY",
22
22
  }
23
23
 
24
24
  export type Pagination = {
@@ -31,7 +31,7 @@ export type FilterStringArr = {
31
31
  values?: string[]
32
32
  }
33
33
 
34
- export type ListProductSkusRequest = {
34
+ export type ListProductSKUsRequest = {
35
35
  product?: string
36
36
  regionId?: string
37
37
  filter?: {[key: string]: FilterStringArr}
@@ -43,59 +43,79 @@ export type SkuItem = {
43
43
  id?: string
44
44
  saleable?: boolean
45
45
  billingType?: BillingType
46
- unit?: UnitType
46
+ meteringUnit?: UnitType
47
+ quantityUnit?: QuantityUnit
47
48
  price?: number
48
49
  region?: string
49
- specId?: string
50
+ specId?: number
50
51
  specName?: string
51
- specDetails?: {[key: string]: string}
52
+ specFields?: SpecField[]
52
53
  }
53
54
 
54
- export type ListProductSkusResponse = {
55
+ export type ListProductSKUsResponse = {
55
56
  items?: SkuItem[]
56
57
  pagination?: Pagination
57
58
  }
58
59
 
59
- export type GetProductSkuRequest = {
60
+ export type GetSKURequest = {
60
61
  id?: string
61
62
  }
62
63
 
63
- export type GetProductSkuResponse = {
64
+ export type SpecField = {
65
+ specId?: number
66
+ key?: string
67
+ value?: string
68
+ keyName?: string
69
+ }
70
+
71
+ export type ListRegionsRequest = {
72
+ }
73
+
74
+ export type ListRegionsResponse = {
75
+ }
76
+
77
+ export type GetSKUResponse = {
64
78
  id?: string
65
79
  saleable?: boolean
66
80
  billingType?: BillingType
67
- unit?: UnitType
81
+ meteringUnit?: UnitType
82
+ quantityUnit?: QuantityUnit
68
83
  price?: number
69
84
  region?: string
70
- specId?: string
85
+ specId?: number
71
86
  specName?: string
72
- specDetails?: {[key: string]: string}
87
+ specFields?: SpecField[]
73
88
  }
74
89
 
75
- export type ListProductSpecDetailValuesRequest = {
76
- regionId?: string
77
- resourceKey?: string
78
- product?: string
90
+ export type GetSKUPriceRequest = {
91
+ id?: string
79
92
  }
80
93
 
81
- export type ProductSpecDetailValueItem = {
82
- id?: string
83
- name?: string
94
+ export type GetSKUPriceResponse = {
95
+ price?: string
84
96
  }
85
97
 
86
- export type ProductSpecDetailValuesArr = {
87
- items?: ProductSpecDetailValueItem[]
98
+ export type ListProductSpecFieldRequest = {
88
99
  }
89
100
 
90
- export type ListProductSpecDetailValuesResponse = {
91
- valuesMap?: {[key: string]: ProductSpecDetailValuesArr}
101
+ export type ListProductSpecFieldResponse = {
102
+ specFields?: SpecField[]
92
103
  }
93
104
 
94
105
  export class Product {
95
- static GetProductSku(req: GetProductSkuRequest, initReq?: fm.InitReq): Promise<GetProductSkuResponse> {
96
- return fm.fetchReq<GetProductSkuRequest, GetProductSkuResponse>(`/apis/leopard.io/v1alpha1/product/skus/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
106
+ static ListProductSKUs(req: ListProductSKUsRequest, initReq?: fm.InitReq): Promise<ListProductSKUsResponse> {
107
+ return fm.fetchReq<ListProductSKUsRequest, ListProductSKUsResponse>(`/apis/leopard.io/v1alpha1/products/skus`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
108
+ }
109
+ static GetSKU(req: GetSKURequest, initReq?: fm.InitReq): Promise<GetSKUResponse> {
110
+ return fm.fetchReq<GetSKURequest, GetSKUResponse>(`/apis/leopard.io/v1alpha1/products/skus/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
111
+ }
112
+ static GetSKUPrice(req: GetSKUPriceRequest, initReq?: fm.InitReq): Promise<GetSKUPriceResponse> {
113
+ return fm.fetchReq<GetSKUPriceRequest, GetSKUPriceResponse>(`/apis/leopard.io/v1alpha1/products/skus/${req["id"]}/price?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
114
+ }
115
+ static ListRegions(req: ListRegionsRequest, initReq?: fm.InitReq): Promise<ListRegionsResponse> {
116
+ return fm.fetchReq<ListRegionsRequest, ListRegionsResponse>(`/apis/leopard.io/v1alpha1/regions?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
97
117
  }
98
- static ListProductSpecDetailValues(req: ListProductSpecDetailValuesRequest, initReq?: fm.InitReq): Promise<ListProductSpecDetailValuesResponse> {
99
- return fm.fetchReq<ListProductSpecDetailValuesRequest, ListProductSpecDetailValuesResponse>(`/apis/leopard.io/v1alpha1/products/${req["product"]}/values?${fm.renderURLSearchParams(req, ["product"])}`, {...initReq, method: "GET"})
118
+ static ListProductSpecDetailValues(req: ListProductSpecFieldRequest, initReq?: fm.InitReq): Promise<ListProductSpecFieldResponse> {
119
+ return fm.fetchReq<ListProductSpecFieldRequest, ListProductSpecFieldResponse>(`/apis/leopard.io/v1alpha1/products/specs?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
100
120
  }
101
121
  }
@@ -1,101 +0,0 @@
1
- /* eslint-disable */
2
- // @ts-nocheck
3
- /*
4
- * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
- */
6
-
7
- import * as fm from "../fetch.pb"
8
-
9
- export enum BillingType {
10
- PAY_AS_YOU_GO = "PAY_AS_YOU_GO",
11
- }
12
-
13
- export enum UnitType {
14
- HOUR = "HOUR",
15
- THOUSAND_TOKENS = "THOUSAND_TOKENS",
16
- GB_DAY = "GB_DAY",
17
- COMPUTE_UNIT = "COMPUTE_UNIT",
18
- }
19
-
20
- export enum QuantityUnit {
21
- EMPTY = "EMPTY",
22
- }
23
-
24
- export type Pagination = {
25
- total?: number
26
- page?: number
27
- pageSize?: number
28
- }
29
-
30
- export type FilterStringArr = {
31
- values?: string[]
32
- }
33
-
34
- export type ListProductSKUsRequest = {
35
- product?: string
36
- regionId?: string
37
- filter?: {[key: string]: FilterStringArr}
38
- page?: number
39
- pageSize?: number
40
- }
41
-
42
- export type SkuItem = {
43
- id?: string
44
- saleable?: boolean
45
- billingType?: BillingType
46
- meteringUnit?: UnitType
47
- quantityUnit?: QuantityUnit
48
- price?: number
49
- region?: string
50
- specId?: number
51
- specName?: string
52
- specDetails?: {[key: string]: string}
53
- }
54
-
55
- export type ListProductSKUsResponse = {
56
- items?: SkuItem[]
57
- pagination?: Pagination
58
- }
59
-
60
- export type GetSKURequest = {
61
- id?: string
62
- }
63
-
64
- export type SpecField = {
65
- specId?: number
66
- key?: string
67
- value?: string
68
- }
69
-
70
- export type GetSKUResponse = {
71
- id?: string
72
- saleable?: boolean
73
- billingType?: BillingType
74
- meteringUnit?: UnitType
75
- quantityUnit?: QuantityUnit
76
- price?: number
77
- region?: string
78
- specId?: number
79
- specName?: string
80
- specFields?: SpecField[]
81
- }
82
-
83
- export type GetSKUPriceRequest = {
84
- id?: string
85
- }
86
-
87
- export type GetSKUPriceResponse = {
88
- price?: string
89
- }
90
-
91
- export class SKU {
92
- static ListProductSKUs(req: ListProductSKUsRequest, initReq?: fm.InitReq): Promise<ListProductSKUsResponse> {
93
- return fm.fetchReq<ListProductSKUsRequest, ListProductSKUsResponse>(`/apis/leopard.io/v1alpha1/skus?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
94
- }
95
- static GetSKU(req: GetSKURequest, initReq?: fm.InitReq): Promise<GetSKUResponse> {
96
- return fm.fetchReq<GetSKURequest, GetSKUResponse>(`/apis/leopard.io/v1alpha1/skus/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
97
- }
98
- static GetSKUPrice(req: GetSKUPriceRequest, initReq?: fm.InitReq): Promise<GetSKUPriceResponse> {
99
- return fm.fetchReq<GetSKUPriceRequest, GetSKUPriceResponse>(`/apis/leopard.io/v1alpha1/skus/${req["id"]}/price?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
100
- }
101
- }