@daocloud-proto/leopard 0.1.0-dev9 → 0.1.0-rc10
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 +1 -1
- package/v1alpha1/bill.pb.ts +6 -4
- package/v1alpha1/inventory.pb.ts +40 -0
- package/v1alpha1/order.pb.ts +61 -22
- package/v1alpha1/product.pb.ts +60 -31
- package/v1alpha1/wallet.pb.ts +7 -6
package/package.json
CHANGED
package/v1alpha1/bill.pb.ts
CHANGED
|
@@ -28,7 +28,9 @@ export type ListBillsRequest = {
|
|
|
28
28
|
pageSize?: number
|
|
29
29
|
billId?: string
|
|
30
30
|
orderId?: string
|
|
31
|
-
|
|
31
|
+
resourceId?: string
|
|
32
|
+
billingType?: string
|
|
33
|
+
productName?: string
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export type ListBillsResponse = {
|
|
@@ -48,9 +50,9 @@ export type bill = {
|
|
|
48
50
|
billingCycle?: BillingCycle
|
|
49
51
|
billingMonth?: string
|
|
50
52
|
productName?: string
|
|
51
|
-
|
|
53
|
+
resources?: Resource[]
|
|
52
54
|
billingType?: BillingType
|
|
53
|
-
unitPrice?:
|
|
55
|
+
unitPrice?: string
|
|
54
56
|
unit?: UnitType
|
|
55
57
|
orderId?: string
|
|
56
58
|
orderPrice?: string
|
|
@@ -63,7 +65,7 @@ export type BillingCycle = {
|
|
|
63
65
|
endTimestamp?: string
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
export type
|
|
68
|
+
export type Resource = {
|
|
67
69
|
name?: string
|
|
68
70
|
id?: string
|
|
69
71
|
}
|
|
@@ -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
|
+
}
|
package/v1alpha1/order.pb.ts
CHANGED
|
@@ -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,30 @@ export type Pagination = {
|
|
|
42
50
|
|
|
43
51
|
export type ListOrdersRequest = {
|
|
44
52
|
orderId?: string
|
|
45
|
-
|
|
46
|
-
orderType?:
|
|
53
|
+
resourceId?: string
|
|
54
|
+
orderType?: string
|
|
47
55
|
productName?: string
|
|
48
|
-
|
|
49
|
-
orderStatus?: OrderStatus
|
|
56
|
+
orderStatus?: string
|
|
50
57
|
start?: string
|
|
51
58
|
end?: string
|
|
52
59
|
page?: number
|
|
53
60
|
pageSize?: number
|
|
54
61
|
}
|
|
55
62
|
|
|
56
|
-
export type
|
|
63
|
+
export type Orders = {
|
|
57
64
|
userName?: string
|
|
58
65
|
orderId?: string
|
|
59
66
|
createdAtTimestamp?: string
|
|
60
67
|
orderType?: OrderType
|
|
61
68
|
productName?: string
|
|
62
|
-
|
|
69
|
+
resources?: Resource[]
|
|
63
70
|
orderStatus?: OrderStatus
|
|
64
|
-
billingType?: BillingType
|
|
65
|
-
unitPrice?: number
|
|
66
|
-
unit?: UnitType
|
|
67
71
|
orderPrice?: string
|
|
68
72
|
amountDue?: string
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
export type ListOrdersResponse = {
|
|
72
|
-
items?:
|
|
76
|
+
items?: Orders[]
|
|
73
77
|
pagination?: Pagination
|
|
74
78
|
}
|
|
75
79
|
|
|
@@ -77,22 +81,20 @@ export type OrderInfo = {
|
|
|
77
81
|
orderId?: string
|
|
78
82
|
createdAtTimestamp?: string
|
|
79
83
|
orderType?: OrderType
|
|
80
|
-
billingType?: BillingType
|
|
81
84
|
orderStatus?: OrderStatus
|
|
82
|
-
region?: string
|
|
83
85
|
orderPrice?: string
|
|
84
86
|
amountDue?: string
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
export type
|
|
89
|
+
export type Resource = {
|
|
88
90
|
name?: string
|
|
89
91
|
id?: string
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
export type ProductInfo = {
|
|
93
|
-
|
|
95
|
+
resources?: Resource[]
|
|
94
96
|
productName?: string
|
|
95
|
-
|
|
97
|
+
resourceNum?: number
|
|
96
98
|
specification?: string
|
|
97
99
|
billingType?: BillingType
|
|
98
100
|
start?: string
|
|
@@ -120,15 +122,46 @@ export type GetProductsResponse = {
|
|
|
120
122
|
products?: Product[]
|
|
121
123
|
}
|
|
122
124
|
|
|
123
|
-
export type
|
|
124
|
-
|
|
125
|
-
productId?: string
|
|
125
|
+
export type OrderItem = {
|
|
126
|
+
productName?: string
|
|
126
127
|
skuId?: string
|
|
127
128
|
quantity?: number
|
|
128
|
-
|
|
129
|
+
resources?: Resource[]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export type CreateNewPurchaseOrderRequest = {
|
|
133
|
+
username?: string
|
|
134
|
+
userId?: string
|
|
135
|
+
orderItems?: OrderItem[]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type CreateNewPurchaseOrderResponse = {
|
|
139
|
+
orderId?: string
|
|
140
|
+
createOrderStatus?: CreateOrderStatus
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type CreateQuantityChangeOrderRequest = {
|
|
144
|
+
username?: string
|
|
145
|
+
userId?: string
|
|
146
|
+
productName?: string
|
|
147
|
+
quantity?: number
|
|
148
|
+
resourceId?: string
|
|
129
149
|
}
|
|
130
150
|
|
|
131
|
-
export type
|
|
151
|
+
export type CreateQuantityChangeOrderResponse = {
|
|
152
|
+
orderId?: string
|
|
153
|
+
createOrderStatus?: CreateOrderStatus
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export type IsResourceOrderNextBillBalanceSufficientRequest = {
|
|
157
|
+
username?: string
|
|
158
|
+
userId?: string
|
|
159
|
+
productName?: string
|
|
160
|
+
resourceId?: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export type IsResourceOrderNextBillBalanceSufficientResponse = {
|
|
164
|
+
sufficient?: boolean
|
|
132
165
|
}
|
|
133
166
|
|
|
134
167
|
export class Order {
|
|
@@ -141,7 +174,13 @@ export class Order {
|
|
|
141
174
|
static GetProducts(req: GetProductsRequest, initReq?: fm.InitReq): Promise<GetProductsResponse> {
|
|
142
175
|
return fm.fetchReq<GetProductsRequest, GetProductsResponse>(`/apis/leopard.io/v1alpha1/orders/products?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
143
176
|
}
|
|
144
|
-
static
|
|
145
|
-
return fm.fetchReq<
|
|
177
|
+
static CreateNewPurchaseOrder(req: CreateNewPurchaseOrderRequest, initReq?: fm.InitReq): Promise<CreateNewPurchaseOrderResponse> {
|
|
178
|
+
return fm.fetchReq<CreateNewPurchaseOrderRequest, CreateNewPurchaseOrderResponse>(`/apis/leopard.io/v1alpha1/orders/new-purchase`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
179
|
+
}
|
|
180
|
+
static CreateQuantityChangeOrder(req: CreateQuantityChangeOrderRequest, initReq?: fm.InitReq): Promise<CreateQuantityChangeOrderResponse> {
|
|
181
|
+
return fm.fetchReq<CreateQuantityChangeOrderRequest, CreateQuantityChangeOrderResponse>(`/apis/leopard.io/v1alpha1/orders/quantity-change`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
182
|
+
}
|
|
183
|
+
static IsResourceOrderNextBillBalanceSufficient(req: IsResourceOrderNextBillBalanceSufficientRequest, initReq?: fm.InitReq): Promise<IsResourceOrderNextBillBalanceSufficientResponse> {
|
|
184
|
+
return fm.fetchReq<IsResourceOrderNextBillBalanceSufficientRequest, IsResourceOrderNextBillBalanceSufficientResponse>(`/apis/leopard.io/v1alpha1/orders/is-resource-balance-sufficient`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
146
185
|
}
|
|
147
186
|
}
|
package/v1alpha1/product.pb.ts
CHANGED
|
@@ -17,8 +17,8 @@ export enum UnitType {
|
|
|
17
17
|
COMPUTE_UNIT = "COMPUTE_UNIT",
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export enum
|
|
21
|
-
|
|
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
|
|
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
|
-
|
|
47
|
-
|
|
47
|
+
meteringUnit?: UnitType
|
|
48
|
+
quantityUnit?: QuantityUnit
|
|
49
|
+
price?: string
|
|
48
50
|
region?: string
|
|
49
|
-
specId?:
|
|
51
|
+
specId?: number
|
|
50
52
|
specName?: string
|
|
51
|
-
|
|
53
|
+
specFields?: SpecField[]
|
|
54
|
+
inventory?: number
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
export type
|
|
57
|
+
export type ListProductSKUsResponse = {
|
|
55
58
|
items?: SkuItem[]
|
|
56
59
|
pagination?: Pagination
|
|
57
60
|
}
|
|
58
61
|
|
|
59
|
-
export type
|
|
62
|
+
export type GetSKURequest = {
|
|
60
63
|
id?: string
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
export type
|
|
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
|
-
|
|
68
|
-
|
|
89
|
+
meteringUnit?: UnitType
|
|
90
|
+
quantityUnit?: QuantityUnit
|
|
91
|
+
price?: string
|
|
69
92
|
region?: string
|
|
70
|
-
specId?:
|
|
93
|
+
specId?: number
|
|
71
94
|
specName?: string
|
|
72
|
-
|
|
95
|
+
specFields?: SpecField[]
|
|
96
|
+
inventory?: number
|
|
73
97
|
}
|
|
74
98
|
|
|
75
|
-
export type
|
|
76
|
-
|
|
77
|
-
resourceKey?: string
|
|
78
|
-
product?: string
|
|
99
|
+
export type GetSKUPriceRequest = {
|
|
100
|
+
id?: string
|
|
79
101
|
}
|
|
80
102
|
|
|
81
|
-
export type
|
|
82
|
-
|
|
83
|
-
name?: string
|
|
103
|
+
export type GetSKUPriceResponse = {
|
|
104
|
+
price?: string
|
|
84
105
|
}
|
|
85
106
|
|
|
86
|
-
export type
|
|
87
|
-
|
|
107
|
+
export type ListProductSpecFieldRequest = {
|
|
108
|
+
regionId?: string
|
|
109
|
+
specKey?: string
|
|
110
|
+
product?: string
|
|
88
111
|
}
|
|
89
112
|
|
|
90
|
-
export type
|
|
91
|
-
|
|
113
|
+
export type ListProductSpecFieldResponse = {
|
|
114
|
+
specFields?: SpecField[]
|
|
92
115
|
}
|
|
93
116
|
|
|
94
117
|
export class Product {
|
|
95
|
-
static
|
|
96
|
-
return fm.fetchReq<
|
|
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
|
|
99
|
-
return fm.fetchReq<
|
|
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
|
|
102
|
-
return fm.fetchReq<
|
|
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
|
}
|
package/v1alpha1/wallet.pb.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type BalanceRequest = {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type BalanceResponse = {
|
|
23
|
-
balance?:
|
|
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
|
|
38
|
+
export type UserStateRequest = {
|
|
39
|
+
userId?: string
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
export type
|
|
42
|
-
|
|
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
|
|
53
|
-
return fm.fetchReq<
|
|
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
|
}
|