@daocloud-proto/hydra 0.2.0-dev-6 → 0.2.0-dev-7
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.
|
@@ -16,6 +16,11 @@ export enum TimePeriod {
|
|
|
16
16
|
TIME_PERIOD_MONTH = "TIME_PERIOD_MONTH",
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export type CreateWSAPIKeyRequest = {
|
|
20
|
+
name?: string
|
|
21
|
+
workspace?: number
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export type CreateAPIKeyRequest = {
|
|
20
25
|
name?: string
|
|
21
26
|
}
|
|
@@ -28,6 +33,13 @@ export type APIKey = {
|
|
|
28
33
|
creationTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
29
34
|
name?: string
|
|
30
35
|
denyModels?: string[]
|
|
36
|
+
workspace?: number
|
|
37
|
+
createBy?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type ListWSAPIKeyRequest = {
|
|
41
|
+
workspace?: number
|
|
42
|
+
page?: HydraCommonCommon.Pagination
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
export type ListAPIKeyRequest = {
|
|
@@ -39,10 +51,24 @@ export type ListAPIKeyResponse = {
|
|
|
39
51
|
page?: HydraCommonCommon.Pagination
|
|
40
52
|
}
|
|
41
53
|
|
|
54
|
+
export type DeleteWSAPIKeyRequest = {
|
|
55
|
+
id?: string
|
|
56
|
+
workspace?: number
|
|
57
|
+
}
|
|
58
|
+
|
|
42
59
|
export type DeleteAPIKeyRequest = {
|
|
43
60
|
id?: string
|
|
44
61
|
}
|
|
45
62
|
|
|
63
|
+
export type WSAPIKeyUsageStatisticsRequest = {
|
|
64
|
+
startTime?: GoogleProtobufTimestamp.Timestamp
|
|
65
|
+
endTime?: GoogleProtobufTimestamp.Timestamp
|
|
66
|
+
ids?: string[]
|
|
67
|
+
models?: string[]
|
|
68
|
+
period?: TimePeriod
|
|
69
|
+
workspace?: number
|
|
70
|
+
}
|
|
71
|
+
|
|
46
72
|
export type APIKeyUsageStatisticsRequest = {
|
|
47
73
|
startTime?: GoogleProtobufTimestamp.Timestamp
|
|
48
74
|
endTime?: GoogleProtobufTimestamp.Timestamp
|
|
@@ -81,4 +107,18 @@ export class APIKeyManagement {
|
|
|
81
107
|
static GetAPIKeyUsageStatistics(req: APIKeyUsageStatisticsRequest, initReq?: fm.InitReq): Promise<APIKeyUsageStatisticsResponse> {
|
|
82
108
|
return fm.fetchReq<APIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/apikeys-stats?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
83
109
|
}
|
|
110
|
+
}
|
|
111
|
+
export class WSAPIKeyManagement {
|
|
112
|
+
static CreateWSAPIKey(req: CreateWSAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
113
|
+
return fm.fetchReq<CreateWSAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
114
|
+
}
|
|
115
|
+
static ListWSAPIKey(req: ListWSAPIKeyRequest, initReq?: fm.InitReq): Promise<ListAPIKeyResponse> {
|
|
116
|
+
return fm.fetchReq<ListWSAPIKeyRequest, ListAPIKeyResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
|
|
117
|
+
}
|
|
118
|
+
static DeleteWSAPIKey(req: DeleteWSAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
119
|
+
return fm.fetchReq<DeleteWSAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
120
|
+
}
|
|
121
|
+
static GetAPIKeyUsageStatistics(req: WSAPIKeyUsageStatisticsRequest, initReq?: fm.InitReq): Promise<APIKeyUsageStatisticsResponse> {
|
|
122
|
+
return fm.fetchReq<WSAPIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys-stats?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
|
|
123
|
+
}
|
|
84
124
|
}
|