@daocloud-proto/leopard 0.1.0-dev8 → 0.1.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.1.0-dev8",
3
+ "version":"0.1.0-rc1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"
@@ -21,18 +21,20 @@ export enum UnitType {
21
21
  COMPUTE_UNIT = "COMPUTE_UNIT",
22
22
  }
23
23
 
24
- export type ListBillingsRequest = {
24
+ export type ListBillsRequest = {
25
25
  start?: string
26
26
  end?: string
27
27
  page?: number
28
28
  pageSize?: number
29
- billingId?: string
29
+ billId?: string
30
30
  orderId?: string
31
- instanceId?: string
31
+ resourceId?: string
32
+ billingType?: string
33
+ productName?: string
32
34
  }
33
35
 
34
- export type ListBillingsResponse = {
35
- items?: billing[]
36
+ export type ListBillsResponse = {
37
+ items?: bill[]
36
38
  pagination?: Pagination
37
39
  }
38
40
 
@@ -42,15 +44,15 @@ export type Pagination = {
42
44
  pageSize?: number
43
45
  }
44
46
 
45
- export type billing = {
47
+ export type bill = {
46
48
  username?: string
47
- billingId?: string
49
+ billId?: string
48
50
  billingCycle?: BillingCycle
49
51
  billingMonth?: string
50
52
  productName?: string
51
- instances?: Instance[]
53
+ resources?: Resource[]
52
54
  billingType?: BillingType
53
- unitPrice?: number
55
+ unitPrice?: string
54
56
  unit?: UnitType
55
57
  orderId?: string
56
58
  orderPrice?: string
@@ -63,13 +65,13 @@ export type BillingCycle = {
63
65
  endTimestamp?: string
64
66
  }
65
67
 
66
- export type Instance = {
68
+ export type Resource = {
67
69
  name?: string
68
70
  id?: string
69
71
  }
70
72
 
71
- export class Billing {
72
- static ListBillings(req: ListBillingsRequest, initReq?: fm.InitReq): Promise<ListBillingsResponse> {
73
- return fm.fetchReq<ListBillingsRequest, ListBillingsResponse>(`/apis/leopard.io/v1alpha1/billings?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
73
+ export class Bill {
74
+ static ListBills(req: ListBillsRequest, initReq?: fm.InitReq): Promise<ListBillsResponse> {
75
+ return fm.fetchReq<ListBillsRequest, ListBillsResponse>(`/apis/leopard.io/v1alpha1/bills?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
74
76
  }
75
77
  }
@@ -0,0 +1,40 @@
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 Action {
10
+ AddOrUpdate = "AddOrUpdate",
11
+ Delete = "Delete",
12
+ }
13
+
14
+ export type UpdateInventoryRequest = {
15
+ action?: Action
16
+ inventory?: inventory
17
+ }
18
+
19
+ export type inventory = {
20
+ region?: string
21
+ node?: string
22
+ resources?: resource[]
23
+ }
24
+
25
+ export type resource = {
26
+ specFieldKey?: string
27
+ specFieldValue?: string
28
+ total?: number
29
+ free?: number
30
+ serial?: string
31
+ }
32
+
33
+ export type UpdateInventoryResponse = {
34
+ }
35
+
36
+ export class Inventory {
37
+ static UpdateInventory(req: UpdateInventoryRequest, initReq?: fm.InitReq): Promise<UpdateInventoryResponse> {
38
+ return fm.fetchReq<UpdateInventoryRequest, UpdateInventoryResponse>(`/v1alpha1.inventory.Inventory/UpdateInventory`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
39
+ }
40
+ }
@@ -34,6 +34,14 @@ export enum UnitType {
34
34
  COMPUTE_UNIT = "COMPUTE_UNIT",
35
35
  }
36
36
 
37
+ export enum CreateOrderStatus {
38
+ SUCCESS = "SUCCESS",
39
+ SKU_NOT_FIND = "SKU_NOT_FIND",
40
+ RESOURCE_NOT_EXIST = "RESOURCE_NOT_EXIST",
41
+ RESOURCE_EXIST = "RESOURCE_EXIST",
42
+ INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
43
+ }
44
+
37
45
  export type Pagination = {
38
46
  total?: number
39
47
  page?: number
@@ -42,34 +50,31 @@ export type Pagination = {
42
50
 
43
51
  export type ListOrdersRequest = {
44
52
  orderId?: string
45
- instanceId?: string
46
- orderType?: OrderType
53
+ resourceId?: string
54
+ orderType?: string
47
55
  productName?: string
48
- payType?: BillingType
49
- orderStatus?: OrderStatus
56
+ orderStatus?: string
50
57
  start?: string
51
58
  end?: string
52
59
  page?: number
53
60
  pageSize?: number
61
+ resourceName?: string
54
62
  }
55
63
 
56
- export type OrderItem = {
64
+ export type Orders = {
57
65
  userName?: string
58
66
  orderId?: string
59
67
  createdAtTimestamp?: string
60
68
  orderType?: OrderType
61
69
  productName?: string
62
- instances?: Instance[]
70
+ resources?: Resource[]
63
71
  orderStatus?: OrderStatus
64
- billingType?: BillingType
65
- unitPrice?: number
66
- unit?: UnitType
67
72
  orderPrice?: string
68
73
  amountDue?: string
69
74
  }
70
75
 
71
76
  export type ListOrdersResponse = {
72
- items?: OrderItem[]
77
+ items?: Orders[]
73
78
  pagination?: Pagination
74
79
  }
75
80
 
@@ -77,22 +82,20 @@ export type OrderInfo = {
77
82
  orderId?: string
78
83
  createdAtTimestamp?: string
79
84
  orderType?: OrderType
80
- billingType?: BillingType
81
85
  orderStatus?: OrderStatus
82
- region?: string
83
86
  orderPrice?: string
84
87
  amountDue?: string
85
88
  }
86
89
 
87
- export type Instance = {
90
+ export type Resource = {
88
91
  name?: string
89
92
  id?: string
90
93
  }
91
94
 
92
95
  export type ProductInfo = {
93
- instances?: Instance[]
96
+ resources?: Resource[]
94
97
  productName?: string
95
- instanceNum?: number
98
+ resourceNum?: number
96
99
  specification?: string
97
100
  billingType?: BillingType
98
101
  start?: string
@@ -120,15 +123,62 @@ export type GetProductsResponse = {
120
123
  products?: Product[]
121
124
  }
122
125
 
123
- export type CreateOrderRequest = {
124
- username?: string
125
- productId?: string
126
+ export type OrderItem = {
127
+ productName?: string
126
128
  skuId?: string
127
129
  quantity?: number
128
- instances?: string[]
130
+ resources?: Resource[]
131
+ }
132
+
133
+ export type CreateNewPurchaseOrderRequest = {
134
+ username?: string
135
+ userId?: string
136
+ orderItems?: OrderItem[]
137
+ }
138
+
139
+ export type CreateNewPurchaseOrderResponse = {
140
+ orderId?: string
141
+ createOrderStatus?: CreateOrderStatus
142
+ }
143
+
144
+ export type CreateQuantityChangeOrderRequest = {
145
+ username?: string
146
+ userId?: string
147
+ productName?: string
148
+ quantity?: number
149
+ resourceId?: string
150
+ }
151
+
152
+ export type CreateQuantityChangeOrderResponse = {
153
+ orderId?: string
154
+ createOrderStatus?: CreateOrderStatus
155
+ }
156
+
157
+ export type IsResourceOrderNextBillBalanceSufficientRequest = {
158
+ username?: string
159
+ userId?: string
160
+ productName?: string
161
+ resourceId?: string
162
+ }
163
+
164
+ export type IsResourceOrderNextBillBalanceSufficientResponse = {
165
+ sufficient?: boolean
129
166
  }
130
167
 
131
- export type CreateOrderResponse = {
168
+ export type GetResourceOrderInfoByResourceIDRequest = {
169
+ resourceId?: string
170
+ }
171
+
172
+ export type GetResourceOrderInfoByResourceIDResponse = {
173
+ resourceId?: string
174
+ resourceName?: string
175
+ username?: string
176
+ skuId?: string
177
+ productName?: string
178
+ billingType?: BillingType
179
+ meteringUnit?: UnitType
180
+ unitPrice?: string
181
+ quantity?: number
132
182
  }
133
183
 
134
184
  export class Order {
@@ -138,10 +188,19 @@ export class Order {
138
188
  static GetOrder(req: GetOrderRequest, initReq?: fm.InitReq): Promise<GetOrderResponse> {
139
189
  return fm.fetchReq<GetOrderRequest, GetOrderResponse>(`/apis/leopard.io/v1alpha1/orders/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
140
190
  }
191
+ static GetResourceOrderInfoByResourceID(req: GetResourceOrderInfoByResourceIDRequest, initReq?: fm.InitReq): Promise<GetResourceOrderInfoByResourceIDResponse> {
192
+ return fm.fetchReq<GetResourceOrderInfoByResourceIDRequest, GetResourceOrderInfoByResourceIDResponse>(`/apis/leopard.io/v1alpha1/orders/resources-info?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
193
+ }
141
194
  static GetProducts(req: GetProductsRequest, initReq?: fm.InitReq): Promise<GetProductsResponse> {
142
195
  return fm.fetchReq<GetProductsRequest, GetProductsResponse>(`/apis/leopard.io/v1alpha1/orders/products?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
143
196
  }
144
- static CreateOrder(req: CreateOrderRequest, initReq?: fm.InitReq): Promise<CreateOrderResponse> {
145
- return fm.fetchReq<CreateOrderRequest, CreateOrderResponse>(`/apis/leopard.io/v1alpha1/orders`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
197
+ static CreateNewPurchaseOrder(req: CreateNewPurchaseOrderRequest, initReq?: fm.InitReq): Promise<CreateNewPurchaseOrderResponse> {
198
+ return fm.fetchReq<CreateNewPurchaseOrderRequest, CreateNewPurchaseOrderResponse>(`/apis/leopard.io/v1alpha1/orders/new-purchase`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
199
+ }
200
+ static CreateQuantityChangeOrder(req: CreateQuantityChangeOrderRequest, initReq?: fm.InitReq): Promise<CreateQuantityChangeOrderResponse> {
201
+ return fm.fetchReq<CreateQuantityChangeOrderRequest, CreateQuantityChangeOrderResponse>(`/apis/leopard.io/v1alpha1/orders/quantity-change`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
202
+ }
203
+ static IsResourceOrderNextBillBalanceSufficient(req: IsResourceOrderNextBillBalanceSufficientRequest, initReq?: fm.InitReq): Promise<IsResourceOrderNextBillBalanceSufficientResponse> {
204
+ return fm.fetchReq<IsResourceOrderNextBillBalanceSufficientRequest, IsResourceOrderNextBillBalanceSufficientResponse>(`/apis/leopard.io/v1alpha1/orders/is-resource-balance-sufficient`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
146
205
  }
147
206
  }
@@ -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,74 +31,103 @@ 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}
38
38
  page?: number
39
39
  pageSize?: number
40
+ filterByAnd?: boolean
40
41
  }
41
42
 
42
43
  export type SkuItem = {
43
44
  id?: string
44
45
  saleable?: boolean
45
46
  billingType?: BillingType
46
- unit?: UnitType
47
- price?: number
47
+ meteringUnit?: UnitType
48
+ quantityUnit?: QuantityUnit
49
+ price?: string
48
50
  region?: string
49
- specId?: string
51
+ specId?: number
50
52
  specName?: string
51
- specDetails?: {[key: string]: string}
53
+ specFields?: SpecField[]
54
+ inventory?: number
52
55
  }
53
56
 
54
- export type ListProductSkusResponse = {
57
+ export type ListProductSKUsResponse = {
55
58
  items?: SkuItem[]
56
59
  pagination?: Pagination
57
60
  }
58
61
 
59
- export type GetProductSkuRequest = {
62
+ export type GetSKURequest = {
60
63
  id?: string
61
64
  }
62
65
 
63
- export type GetProductSkuResponse = {
66
+ export type SpecField = {
67
+ specId?: number
68
+ key?: string
69
+ value?: string
70
+ keyName?: string
71
+ }
72
+
73
+ export type ListRegionsRequest = {
74
+ }
75
+
76
+ export type Region = {
77
+ regionId?: string
78
+ regionName?: string
79
+ }
80
+
81
+ export type ListRegionsResponse = {
82
+ items?: Region[]
83
+ }
84
+
85
+ export type GetSKUResponse = {
64
86
  id?: string
65
87
  saleable?: boolean
66
88
  billingType?: BillingType
67
- unit?: UnitType
68
- price?: number
89
+ meteringUnit?: UnitType
90
+ quantityUnit?: QuantityUnit
91
+ price?: string
69
92
  region?: string
70
- specId?: string
93
+ specId?: number
71
94
  specName?: string
72
- specDetails?: {[key: string]: string}
95
+ specFields?: SpecField[]
96
+ inventory?: number
73
97
  }
74
98
 
75
- export type ListProductSpecDetailValuesRequest = {
76
- regionId?: string
77
- resourceKey?: string
78
- product?: string
99
+ export type GetSKUPriceRequest = {
100
+ id?: string
79
101
  }
80
102
 
81
- export type ProductSpecDetailValueItem = {
82
- id?: string
83
- name?: string
103
+ export type GetSKUPriceResponse = {
104
+ price?: string
84
105
  }
85
106
 
86
- export type ProductSpecDetailValuesArr = {
87
- items?: ProductSpecDetailValueItem[]
107
+ export type ListProductSpecFieldRequest = {
108
+ regionId?: string
109
+ specKey?: string
110
+ product?: string
88
111
  }
89
112
 
90
- export type ListProductSpecDetailValuesResponse = {
91
- valuesMap?: {[key: string]: ProductSpecDetailValuesArr}
113
+ export type ListProductSpecFieldResponse = {
114
+ specFields?: SpecField[]
92
115
  }
93
116
 
94
117
  export class Product {
95
- static ListProductSkus(req: ListProductSkusRequest, initReq?: fm.InitReq): Promise<ListProductSkusResponse> {
96
- return fm.fetchReq<ListProductSkusRequest, ListProductSkusResponse>(`/apis/leopard.io/v1alpha1/product/${req["product"]}/skus?${fm.renderURLSearchParams(req, ["product"])}`, {...initReq, method: "GET"})
118
+ static ListProductSKUs(req: ListProductSKUsRequest, initReq?: fm.InitReq): Promise<ListProductSKUsResponse> {
119
+ return fm.fetchReq<ListProductSKUsRequest, ListProductSKUsResponse>(`/apis/leopard.io/v1alpha1/products/skus`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
120
+ }
121
+ static GetSKU(req: GetSKURequest, initReq?: fm.InitReq): Promise<GetSKUResponse> {
122
+ return fm.fetchReq<GetSKURequest, GetSKUResponse>(`/apis/leopard.io/v1alpha1/products/skus/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
123
+ }
124
+ static GetSKUPrice(req: GetSKUPriceRequest, initReq?: fm.InitReq): Promise<GetSKUPriceResponse> {
125
+ return fm.fetchReq<GetSKUPriceRequest, GetSKUPriceResponse>(`/apis/leopard.io/v1alpha1/products/skus/${req["id"]}/price?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
97
126
  }
98
- static GetProductSku(req: GetProductSkuRequest, initReq?: fm.InitReq): Promise<GetProductSkuResponse> {
99
- return fm.fetchReq<GetProductSkuRequest, GetProductSkuResponse>(`/apis/leopard.io/v1alpha1/product/skus/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
127
+ static ListRegions(req: ListRegionsRequest, initReq?: fm.InitReq): Promise<ListRegionsResponse> {
128
+ return fm.fetchReq<ListRegionsRequest, ListRegionsResponse>(`/apis/leopard.io/v1alpha1/products/regions?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
100
129
  }
101
- static ListProductSpecDetailValues(req: ListProductSpecDetailValuesRequest, initReq?: fm.InitReq): Promise<ListProductSpecDetailValuesResponse> {
102
- return fm.fetchReq<ListProductSpecDetailValuesRequest, ListProductSpecDetailValuesResponse>(`/apis/leopard.io/v1alpha1/products/${req["product"]}/values?${fm.renderURLSearchParams(req, ["product"])}`, {...initReq, method: "GET"})
130
+ static ListProductSpecFieldValues(req: ListProductSpecFieldRequest, initReq?: fm.InitReq): Promise<ListProductSpecFieldResponse> {
131
+ return fm.fetchReq<ListProductSpecFieldRequest, ListProductSpecFieldResponse>(`/apis/leopard.io/v1alpha1/products/specs?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
103
132
  }
104
133
  }
@@ -20,7 +20,7 @@ export type BalanceRequest = {
20
20
  }
21
21
 
22
22
  export type BalanceResponse = {
23
- balance?: number
23
+ balance?: string
24
24
  }
25
25
 
26
26
  export type RechargeRequest = {
@@ -35,11 +35,12 @@ export type RechargeResponse = {
35
35
  redirectUrl?: string
36
36
  }
37
37
 
38
- export type AlipayNotifyRequest = {
38
+ export type UserStateRequest = {
39
+ userId?: string
39
40
  }
40
41
 
41
- export type AlipayNotifyResponse = {
42
- message?: string
42
+ export type UserStateResponse = {
43
+ amount?: string
43
44
  }
44
45
 
45
46
  export class Wallet {
@@ -49,7 +50,7 @@ export class Wallet {
49
50
  static Recharge(req: RechargeRequest, initReq?: fm.InitReq): Promise<RechargeResponse> {
50
51
  return fm.fetchReq<RechargeRequest, RechargeResponse>(`/apis/leopard.io/v1alpha1/wallet/recharge`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
51
52
  }
52
- static AlipayNotify(req: AlipayNotifyRequest, initReq?: fm.InitReq): Promise<AlipayNotifyResponse> {
53
- return fm.fetchReq<AlipayNotifyRequest, AlipayNotifyResponse>(`/apis/leopard.io/v1alpha1/wallet/alipay/notify`, {...initReq, method: "POST"})
53
+ static UserState(req: UserStateRequest, initReq?: fm.InitReq): Promise<UserStateResponse> {
54
+ return fm.fetchReq<UserStateRequest, UserStateResponse>(`/v1alpha1.wallet.Wallet/UserState`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
54
55
  }
55
56
  }
@@ -1,19 +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
- export type HelloRequest = {
9
- }
10
-
11
- export type HelloResponse = {
12
- message?: string
13
- }
14
-
15
- export class Hello {
16
- static Hello(req: HelloRequest, initReq?: fm.InitReq): Promise<HelloResponse> {
17
- return fm.fetchReq<HelloRequest, HelloResponse>(`/apis/leopard.io/v1alpha1/hello?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
18
- }
19
- }