@daocloud-proto/skoala 0.21.2 → 0.22.1-10
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/api/general/v1alpha1/common.pb.ts +1 -0
- package/api/hosted/v1alpha1/gateway.pb.ts +19 -0
- package/api/hosted/v1alpha1/mesh.pb.ts +99 -0
- package/api/hosted/v1alpha1/nacos.pb.ts +1 -0
- package/api/hosted/v1alpha1/sentinel.pb.ts +21 -1
- package/api/hosted/v1alpha1/skoala_plugins.pb.ts +10 -0
- package/api/hosted/v1alpha1/virtualhost.pb.ts +0 -11
- package/api/skoala/v1alpha1/skoala.pb.ts +11 -2
- package/package.json +1 -1
- package/api/skoala/v1alpha1/book.pb.ts +0 -100
|
@@ -89,6 +89,11 @@ export enum GatewayConditionStatus {
|
|
|
89
89
|
Unknown = "Unknown",
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
export enum TracingConfigtagType {
|
|
93
|
+
Literal = "Literal",
|
|
94
|
+
Header = "Header",
|
|
95
|
+
}
|
|
96
|
+
|
|
92
97
|
export enum LogLogLevel {
|
|
93
98
|
STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED",
|
|
94
99
|
Trace = "Trace",
|
|
@@ -287,11 +292,25 @@ export type GlobalRatelimitConfig = {
|
|
|
287
292
|
type BaseContourAdvancedConfig = {
|
|
288
293
|
resources?: SkoalaApiGeneralV1alpha1Resource.ResourceRequirements
|
|
289
294
|
diagnostic?: GatewayDiagnostic
|
|
295
|
+
tracingConfig?: TracingConfig
|
|
290
296
|
}
|
|
291
297
|
|
|
292
298
|
export type ContourAdvancedConfig = BaseContourAdvancedConfig
|
|
293
299
|
& OneOf<{ rollingUpdate: RollingUpdate; recreate: string }>
|
|
294
300
|
|
|
301
|
+
export type TracingConfigcustomTag = {
|
|
302
|
+
tagName?: string
|
|
303
|
+
tagType?: TracingConfigtagType
|
|
304
|
+
tagValue?: string
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export type TracingConfig = {
|
|
308
|
+
enabled?: boolean
|
|
309
|
+
sampling?: number
|
|
310
|
+
maxPathLength?: number
|
|
311
|
+
customTags?: TracingConfigcustomTag[]
|
|
312
|
+
}
|
|
313
|
+
|
|
295
314
|
|
|
296
315
|
type BaseEnvoyAdvancedConfig = {
|
|
297
316
|
resources?: SkoalaApiGeneralV1alpha1Resource.ResourceRequirements
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as GoogleProtobufAny from "../../../google/protobuf/any.pb"
|
|
8
8
|
import * as GoogleProtobufDuration from "../../../google/protobuf/duration.pb"
|
|
9
|
+
import * as GoogleProtobufStruct from "../../../google/protobuf/struct.pb"
|
|
9
10
|
import * as SkoalaApiGeneralV1alpha1Common from "../../general/v1alpha1/common.pb"
|
|
10
11
|
|
|
11
12
|
type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
|
|
@@ -54,6 +55,17 @@ export enum ServiceType {
|
|
|
54
55
|
DUBBO = "DUBBO",
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
export enum GovernProtocol {
|
|
59
|
+
GOVERN_PROTOCOL_UNSPECIFIED = "GOVERN_PROTOCOL_UNSPECIFIED",
|
|
60
|
+
GOVERN_TCP = "GOVERN_TCP",
|
|
61
|
+
GOVERN_HTTP = "GOVERN_HTTP",
|
|
62
|
+
GOVERN_HTTP2 = "GOVERN_HTTP2",
|
|
63
|
+
GOVERN_HTTPS = "GOVERN_HTTPS",
|
|
64
|
+
GOVERN_TLS = "GOVERN_TLS",
|
|
65
|
+
GOVERN_GRPC = "GOVERN_GRPC",
|
|
66
|
+
GOVERN_UNSUPPORTED = "GOVERN_UNSUPPORTED",
|
|
67
|
+
}
|
|
68
|
+
|
|
57
69
|
export enum LB {
|
|
58
70
|
UNSPECIFIED = "UNSPECIFIED",
|
|
59
71
|
LEAST_CONN = "LEAST_CONN",
|
|
@@ -62,6 +74,18 @@ export enum LB {
|
|
|
62
74
|
ROUND_ROBIN = "ROUND_ROBIN",
|
|
63
75
|
}
|
|
64
76
|
|
|
77
|
+
export enum WasmPluginPhase {
|
|
78
|
+
UNSPECIFIED_PHASE = "UNSPECIFIED_PHASE",
|
|
79
|
+
AUTHN = "AUTHN",
|
|
80
|
+
AUTHZ = "AUTHZ",
|
|
81
|
+
STATS = "STATS",
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export enum ImagePullPolicy {
|
|
85
|
+
Always = "Always",
|
|
86
|
+
IfNotPresent = "IfNotPresent",
|
|
87
|
+
}
|
|
88
|
+
|
|
65
89
|
|
|
66
90
|
type BaseIstioResource = {
|
|
67
91
|
type?: ResourceType
|
|
@@ -223,6 +247,33 @@ export type ListServiceGovern = {
|
|
|
223
247
|
port?: number
|
|
224
248
|
lb?: LB
|
|
225
249
|
updateTime?: number
|
|
250
|
+
protocol?: GovernProtocol
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type UpdateServiceWasmPluginReq = {
|
|
254
|
+
workspaceId?: string
|
|
255
|
+
meshId?: string
|
|
256
|
+
namespaceName?: string
|
|
257
|
+
serviceName?: string
|
|
258
|
+
port?: number
|
|
259
|
+
wasmPlugin?: WasmPlugin[]
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export type UpdateServiceWasmPluginRes = {
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export type GetServiceWasmPluginReq = {
|
|
266
|
+
workspaceId?: string
|
|
267
|
+
meshId?: string
|
|
268
|
+
namespaceName?: string
|
|
269
|
+
serviceName?: string
|
|
270
|
+
port?: number
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export type GetServiceWasmPluginRes = {
|
|
274
|
+
serviceName?: string
|
|
275
|
+
port?: number
|
|
276
|
+
wasmPlugin?: WasmPlugin[]
|
|
226
277
|
}
|
|
227
278
|
|
|
228
279
|
export type UpdateServiceGovernReq = {
|
|
@@ -231,9 +282,51 @@ export type UpdateServiceGovernReq = {
|
|
|
231
282
|
namespaceName?: string
|
|
232
283
|
serviceName?: string
|
|
233
284
|
port?: number
|
|
285
|
+
protocol?: GovernProtocol
|
|
234
286
|
lb?: LB
|
|
235
287
|
outlierDetection?: OutlierDetection
|
|
236
288
|
connectionPool?: ConnectionPool
|
|
289
|
+
rewrite?: HTTPRewrite
|
|
290
|
+
timeout?: GoogleProtobufDuration.Duration
|
|
291
|
+
fault?: HTTPFaultInjection
|
|
292
|
+
retries?: HTTPRetry
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export type HTTPRewrite = {
|
|
296
|
+
uri?: string
|
|
297
|
+
authority?: string
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export type HTTPFaultInjection = {
|
|
301
|
+
delay?: HTTPFaultInjection_Delay
|
|
302
|
+
abort?: HTTPFaultInjection_Abort
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export type HTTPFaultInjection_Delay = {
|
|
306
|
+
percentage?: number
|
|
307
|
+
fixedDelay?: GoogleProtobufDuration.Duration
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
type BaseHTTPFaultInjection_Abort = {
|
|
312
|
+
percentage?: number
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export type HTTPFaultInjection_Abort = BaseHTTPFaultInjection_Abort
|
|
316
|
+
& OneOf<{ httpStatus: number; grpcStatus: string; http2Error: string }>
|
|
317
|
+
|
|
318
|
+
export type HTTPRetry = {
|
|
319
|
+
attempts?: number
|
|
320
|
+
perTryTimeout?: GoogleProtobufDuration.Duration
|
|
321
|
+
retryOn?: string
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export type WasmPlugin = {
|
|
325
|
+
wasmPluginName?: string
|
|
326
|
+
imagePullPolicy?: ImagePullPolicy
|
|
327
|
+
imagePullSecret?: string
|
|
328
|
+
pluginConfig?: GoogleProtobufStruct.Struct
|
|
329
|
+
phase?: WasmPluginPhase
|
|
237
330
|
}
|
|
238
331
|
|
|
239
332
|
export type OutlierDetection = {
|
|
@@ -260,12 +353,18 @@ export type GetServiceGovernReq = {
|
|
|
260
353
|
namespaceName?: string
|
|
261
354
|
serviceName?: string
|
|
262
355
|
port?: number
|
|
356
|
+
protocol?: GovernProtocol
|
|
263
357
|
}
|
|
264
358
|
|
|
265
359
|
export type GetServiceGovernRes = {
|
|
266
360
|
serviceName?: string
|
|
267
361
|
port?: number
|
|
362
|
+
protocol?: GovernProtocol
|
|
268
363
|
lb?: LB
|
|
269
364
|
outlierDetection?: OutlierDetection
|
|
270
365
|
connectionPool?: ConnectionPool
|
|
366
|
+
rewrite?: HTTPRewrite
|
|
367
|
+
timeout?: GoogleProtobufDuration.Duration
|
|
368
|
+
fault?: HTTPFaultInjection
|
|
369
|
+
retries?: HTTPRetry
|
|
271
370
|
}
|
|
@@ -24,8 +24,13 @@ export enum ControlBehavior {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export enum MachineType {
|
|
27
|
-
EMBEDDED = "EMBEDDED",
|
|
28
27
|
ALONE = "ALONE",
|
|
28
|
+
EMBEDDED = "EMBEDDED",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum ThresholdType {
|
|
32
|
+
SHARED = "SHARED",
|
|
33
|
+
OVERALL = "OVERALL",
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
export enum HostedQuery {
|
|
@@ -85,6 +90,7 @@ export type GetSentinelDashGrafanaReq = {
|
|
|
85
90
|
clusterName?: string
|
|
86
91
|
namespaceName?: string
|
|
87
92
|
sentinelName?: string
|
|
93
|
+
instanceIp?: string
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
export type GetSentinelDashGrafanaRes = {
|
|
@@ -97,6 +103,8 @@ export type GetAppsSentinelGrafanaReq = {
|
|
|
97
103
|
clusterName?: string
|
|
98
104
|
sentinel?: string
|
|
99
105
|
app?: string
|
|
106
|
+
instanceIp?: string
|
|
107
|
+
resource?: string
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
export type GetAppsSentinelGrafanaRes = {
|
|
@@ -146,6 +154,7 @@ export type ListClusterFlowReq = {
|
|
|
146
154
|
namespaceName?: string
|
|
147
155
|
sentinelName?: string
|
|
148
156
|
appName?: string
|
|
157
|
+
serverId?: string
|
|
149
158
|
}
|
|
150
159
|
|
|
151
160
|
export type GetClusterFlowReq = {
|
|
@@ -205,6 +214,7 @@ export type TokenServerReq = {
|
|
|
205
214
|
maxQps?: number
|
|
206
215
|
clients?: string[]
|
|
207
216
|
remainingClients?: string[]
|
|
217
|
+
tokenServerName?: string
|
|
208
218
|
}
|
|
209
219
|
|
|
210
220
|
export type ListAppReq = {
|
|
@@ -250,6 +260,12 @@ export type FlowRule = {
|
|
|
250
260
|
warmUpPeriodSec?: number
|
|
251
261
|
maxQueueingTimeMs?: number
|
|
252
262
|
clusterMode?: boolean
|
|
263
|
+
clusterConfig?: ClusterFlowConfig
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type ClusterFlowConfig = {
|
|
267
|
+
thresholdType?: ThresholdType
|
|
268
|
+
fallbackToLocalWhenFail?: boolean
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
export type CreateFlowRuleReq = {
|
|
@@ -269,6 +285,7 @@ export type ListFlowRuleReq = {
|
|
|
269
285
|
appName?: string
|
|
270
286
|
page?: number
|
|
271
287
|
pageSize?: number
|
|
288
|
+
resource?: string
|
|
272
289
|
}
|
|
273
290
|
|
|
274
291
|
export type ListFlowRuleRes = {
|
|
@@ -340,6 +357,7 @@ export type ListDegradeRuleReq = {
|
|
|
340
357
|
appName?: string
|
|
341
358
|
page?: number
|
|
342
359
|
pageSize?: number
|
|
360
|
+
resource?: string
|
|
343
361
|
}
|
|
344
362
|
|
|
345
363
|
export type ListDegradeRuleRes = {
|
|
@@ -415,6 +433,7 @@ export type ListParamFlowRuleReq = {
|
|
|
415
433
|
appName?: string
|
|
416
434
|
page?: number
|
|
417
435
|
pageSize?: number
|
|
436
|
+
resource?: string
|
|
418
437
|
}
|
|
419
438
|
|
|
420
439
|
export type ListParamFlowRuleRes = {
|
|
@@ -549,6 +568,7 @@ export type ListAuthorityRuleReq = {
|
|
|
549
568
|
appName?: string
|
|
550
569
|
page?: number
|
|
551
570
|
pageSize?: number
|
|
571
|
+
resource?: string
|
|
552
572
|
}
|
|
553
573
|
|
|
554
574
|
export type ListAuthorityRuleRes = {
|
|
@@ -248,4 +248,14 @@ export type GetRLSRuleReq = {
|
|
|
248
248
|
workspaceId?: string
|
|
249
249
|
pluginName?: string
|
|
250
250
|
domain?: string
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type SkoalaPluginUpdateReq = {
|
|
254
|
+
workspaceId?: string
|
|
255
|
+
pluginName?: string
|
|
256
|
+
add?: boolean
|
|
257
|
+
pluginUsage?: PluginUsage
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type SkoalaPluginUpdateRes = {
|
|
251
261
|
}
|
|
@@ -54,22 +54,11 @@ export type AuthorizationPolicy = {
|
|
|
54
54
|
authPluginName?: string
|
|
55
55
|
disabled?: boolean
|
|
56
56
|
context?: {[key: string]: string}
|
|
57
|
-
authServer?: string
|
|
58
|
-
failOpen?: boolean
|
|
59
|
-
responseTimeout?: string
|
|
60
|
-
maxRequestBytes?: number
|
|
61
|
-
allowPartialMessage?: boolean
|
|
62
|
-
packAsBytes?: boolean
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
export type JwtProvider = {
|
|
66
60
|
jwtPluginName?: string
|
|
67
|
-
audiences?: string[]
|
|
68
61
|
default?: boolean
|
|
69
|
-
forwardJWT?: boolean
|
|
70
|
-
issuer?: string
|
|
71
|
-
name?: string
|
|
72
|
-
remoteJwks?: RemoteJWKS
|
|
73
62
|
}
|
|
74
63
|
|
|
75
64
|
export type RemoteJWKS = {
|
|
@@ -446,10 +446,16 @@ export class Mesh {
|
|
|
446
446
|
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.ListServiceGovernReq, SkoalaApiHostedV1alpha1Mesh.ListServiceGovernRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}?${fm.renderURLSearchParams(req, ["workspaceId", "meshId", "namespaceName", "serviceName"])}`, {...initReq, method: "GET"})
|
|
447
447
|
}
|
|
448
448
|
static UpdateServiceGovern(req: SkoalaApiHostedV1alpha1Mesh.UpdateServiceGovernReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Mesh.UpdateServiceGovernRes> {
|
|
449
|
-
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.UpdateServiceGovernReq, SkoalaApiHostedV1alpha1Mesh.UpdateServiceGovernRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}/ports/${req["port"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
449
|
+
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.UpdateServiceGovernReq, SkoalaApiHostedV1alpha1Mesh.UpdateServiceGovernRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}/ports/${req["port"]}/protocols/${req["protocol"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
450
450
|
}
|
|
451
451
|
static GetServiceGovern(req: SkoalaApiHostedV1alpha1Mesh.GetServiceGovernReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Mesh.GetServiceGovernRes> {
|
|
452
|
-
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.GetServiceGovernReq, SkoalaApiHostedV1alpha1Mesh.GetServiceGovernRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}/ports/${req["port"]}?${fm.renderURLSearchParams(req, ["workspaceId", "meshId", "namespaceName", "serviceName", "port"])}`, {...initReq, method: "GET"})
|
|
452
|
+
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.GetServiceGovernReq, SkoalaApiHostedV1alpha1Mesh.GetServiceGovernRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}/ports/${req["port"]}/protocols/${req["protocol"]}?${fm.renderURLSearchParams(req, ["workspaceId", "meshId", "namespaceName", "serviceName", "port", "protocol"])}`, {...initReq, method: "GET"})
|
|
453
|
+
}
|
|
454
|
+
static UpdateServiceWasmPlugin(req: SkoalaApiHostedV1alpha1Mesh.UpdateServiceWasmPluginReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Mesh.UpdateServiceWasmPluginRes> {
|
|
455
|
+
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.UpdateServiceWasmPluginReq, SkoalaApiHostedV1alpha1Mesh.UpdateServiceWasmPluginRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}/ports/${req["port"]}/wasmplugin`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
456
|
+
}
|
|
457
|
+
static GetServiceWasmPlugin(req: SkoalaApiHostedV1alpha1Mesh.GetServiceWasmPluginReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Mesh.GetServiceWasmPluginRes> {
|
|
458
|
+
return fm.fetchReq<SkoalaApiHostedV1alpha1Mesh.GetServiceWasmPluginReq, SkoalaApiHostedV1alpha1Mesh.GetServiceWasmPluginRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/meshes/${req["meshId"]}/namespaces/${req["namespaceName"]}/services/${req["serviceName"]}/ports/${req["port"]}/wasmplugin?${fm.renderURLSearchParams(req, ["workspaceId", "meshId", "namespaceName", "serviceName", "port"])}`, {...initReq, method: "GET"})
|
|
453
459
|
}
|
|
454
460
|
}
|
|
455
461
|
export class Plugin {
|
|
@@ -690,4 +696,7 @@ export class SkoalaPlugin {
|
|
|
690
696
|
static GetRLSDomainRules(req: SkoalaApiHostedV1alpha1Skoala_plugins.GetRLSDomainRulesReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Skoala_plugins.GetRLSDomainRulesRes> {
|
|
691
697
|
return fm.fetchReq<SkoalaApiHostedV1alpha1Skoala_plugins.GetRLSDomainRulesReq, SkoalaApiHostedV1alpha1Skoala_plugins.GetRLSDomainRulesRes>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/plugins/rls/${req["pluginName"]}/domain/${req["domain"]}?${fm.renderURLSearchParams(req, ["workspaceId", "pluginName", "domain"])}`, {...initReq, method: "GET"})
|
|
692
698
|
}
|
|
699
|
+
static SkoalaPluginUsageUpdate(req: SkoalaApiHostedV1alpha1Skoala_plugins.SkoalaPluginUpdateReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Skoala_plugins.SkoalaPluginUpdateRes> {
|
|
700
|
+
return fm.fetchReq<SkoalaApiHostedV1alpha1Skoala_plugins.SkoalaPluginUpdateReq, SkoalaApiHostedV1alpha1Skoala_plugins.SkoalaPluginUpdateRes>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/plugins/${req["pluginName"]}/usage`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
701
|
+
}
|
|
693
702
|
}
|
package/package.json
CHANGED
|
@@ -1,100 +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
|
-
import * as GoogleProtobufEmpty from "../../../google/protobuf/empty.pb"
|
|
9
|
-
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
-
|
|
11
|
-
export enum Status {
|
|
12
|
-
TAKEDOWN = "TAKEDOWN",
|
|
13
|
-
ONSHELF = "ONSHELF",
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type GetBookReq = {
|
|
17
|
-
uid?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type GetBookReply = {
|
|
21
|
-
uid?: string
|
|
22
|
-
name?: string
|
|
23
|
-
author?: string
|
|
24
|
-
status?: Status
|
|
25
|
-
isPublished?: boolean
|
|
26
|
-
publishedAt?: GoogleProtobufTimestamp.Timestamp
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ListBookReq = {
|
|
30
|
-
pageNum?: number
|
|
31
|
-
pageSize?: number
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type ListBookReplyBook = {
|
|
35
|
-
uid?: string
|
|
36
|
-
name?: string
|
|
37
|
-
author?: string
|
|
38
|
-
status?: Status
|
|
39
|
-
isPublished?: boolean
|
|
40
|
-
publishedAt?: GoogleProtobufTimestamp.Timestamp
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type ListBookReply = {
|
|
44
|
-
results?: ListBookReplyBook[]
|
|
45
|
-
totalCount?: number
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type CreateBookReq = {
|
|
49
|
-
name?: string
|
|
50
|
-
author?: string
|
|
51
|
-
status?: Status
|
|
52
|
-
isPublished?: boolean
|
|
53
|
-
publishedAt?: GoogleProtobufTimestamp.Timestamp
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type CreateBookReply = {
|
|
57
|
-
uid?: string
|
|
58
|
-
name?: string
|
|
59
|
-
author?: string
|
|
60
|
-
status?: Status
|
|
61
|
-
isPublished?: boolean
|
|
62
|
-
publishedAt?: GoogleProtobufTimestamp.Timestamp
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export type UpdateBookReq = {
|
|
66
|
-
uid?: string
|
|
67
|
-
author?: string
|
|
68
|
-
status?: Status
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type UpdateBookRely = {
|
|
72
|
-
uid?: string
|
|
73
|
-
name?: string
|
|
74
|
-
author?: string
|
|
75
|
-
status?: Status
|
|
76
|
-
isPublished?: boolean
|
|
77
|
-
publishedAt?: GoogleProtobufTimestamp.Timestamp
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type DeleteBookReq = {
|
|
81
|
-
uid?: string
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export class Book {
|
|
85
|
-
static Get(req: GetBookReq, initReq?: fm.InitReq): Promise<GetBookReply> {
|
|
86
|
-
return fm.fetchReq<GetBookReq, GetBookReply>(`/v1alpha1/books/${req["uid"]}?${fm.renderURLSearchParams(req, ["uid"])}`, {...initReq, method: "GET"})
|
|
87
|
-
}
|
|
88
|
-
static List(req: ListBookReq, initReq?: fm.InitReq): Promise<ListBookReply> {
|
|
89
|
-
return fm.fetchReq<ListBookReq, ListBookReply>(`/v1alpha1/books?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
90
|
-
}
|
|
91
|
-
static Create(req: CreateBookReq, initReq?: fm.InitReq): Promise<CreateBookReply> {
|
|
92
|
-
return fm.fetchReq<CreateBookReq, CreateBookReply>(`/v1alpha1/books`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
93
|
-
}
|
|
94
|
-
static Update(req: UpdateBookReq, initReq?: fm.InitReq): Promise<UpdateBookRely> {
|
|
95
|
-
return fm.fetchReq<UpdateBookReq, UpdateBookRely>(`/v1alpha1/books/${req["uid"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
96
|
-
}
|
|
97
|
-
static Delete(req: DeleteBookReq, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
|
|
98
|
-
return fm.fetchReq<DeleteBookReq, GoogleProtobufEmpty.Empty>(`/v1alpha1/books/${req["uid"]}`, {...initReq, method: "DELETE"})
|
|
99
|
-
}
|
|
100
|
-
}
|