@daocloud-proto/ghippo 0.0.1 → 0.1.1

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.
@@ -0,0 +1,121 @@
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 GoogleApiHttpbody from "../google/api/httpbody.pb"
9
+ export type GetThemeCSSRequest = {
10
+ }
11
+
12
+ export type GetThemeConfigRequest = {
13
+ }
14
+
15
+ export type GetThemeConfigResponse = {
16
+ id?: string
17
+ name?: string
18
+ css?: string
19
+ createdAt?: string
20
+ updatedAt?: string
21
+ }
22
+
23
+ export type SetThemeConfigRequest = {
24
+ css?: string
25
+ }
26
+
27
+ export type SetThemeConfigResponse = {
28
+ }
29
+
30
+ export type ResetThemeConfigRequest = {
31
+ }
32
+
33
+ export type ResetThemeConfigResponse = {
34
+ }
35
+
36
+ export type GetLoginThemeCSSRequest = {
37
+ }
38
+
39
+ export type GetLoginThemeConfigRequest = {
40
+ }
41
+
42
+ export type GetLoginThemeConfigResponse = {
43
+ id?: string
44
+ name?: string
45
+ css?: string
46
+ createdAt?: string
47
+ updatedAt?: string
48
+ }
49
+
50
+ export type SetLoginThemeConfigRequest = {
51
+ css?: string
52
+ }
53
+
54
+ export type SetLoginThemeConfigResponse = {
55
+ }
56
+
57
+ export type ResetLoginThemeConfigRequest = {
58
+ }
59
+
60
+ export type ResetLoginThemeConfigResponse = {
61
+ }
62
+
63
+ export type GetFooterThemeConfigRequest = {
64
+ }
65
+
66
+ export type GetFooterThemeConfigResponse = {
67
+ id?: string
68
+ name?: string
69
+ css?: string
70
+ createdAt?: string
71
+ updatedAt?: string
72
+ }
73
+
74
+ export type SetFooterThemeConfigRequest = {
75
+ css?: string
76
+ }
77
+
78
+ export type SetFooterThemeConfigResponse = {
79
+ }
80
+
81
+ export type ResetFooterThemeConfigRequest = {
82
+ }
83
+
84
+ export type ResetFooterThemeConfigResponse = {
85
+ }
86
+
87
+ export class Theme {
88
+ static GetThemeCSS(req: GetThemeCSSRequest, initReq?: fm.InitReq): Promise<GoogleApiHttpbody.HttpBody> {
89
+ return fm.fetchReq<GetThemeCSSRequest, GoogleApiHttpbody.HttpBody>(`/apis/ghippo.io/v1alpha1/themes/theme.css?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
90
+ }
91
+ static GetThemeConfig(req: GetThemeConfigRequest, initReq?: fm.InitReq): Promise<GetThemeConfigResponse> {
92
+ return fm.fetchReq<GetThemeConfigRequest, GetThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/theme?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
93
+ }
94
+ static SetThemeConfig(req: SetThemeConfigRequest, initReq?: fm.InitReq): Promise<SetThemeConfigResponse> {
95
+ return fm.fetchReq<SetThemeConfigRequest, SetThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/theme`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
96
+ }
97
+ static ResetThemeConfig(req: ResetThemeConfigRequest, initReq?: fm.InitReq): Promise<ResetThemeConfigResponse> {
98
+ return fm.fetchReq<ResetThemeConfigRequest, ResetThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/theme/reset`, {...initReq, method: "POST"})
99
+ }
100
+ static GetLoginThemeCSS(req: GetLoginThemeCSSRequest, initReq?: fm.InitReq): Promise<GoogleApiHttpbody.HttpBody> {
101
+ return fm.fetchReq<GetLoginThemeCSSRequest, GoogleApiHttpbody.HttpBody>(`/apis/ghippo.io/v1alpha1/themes/login_page.css?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
102
+ }
103
+ static GetLoginThemeConfig(req: GetLoginThemeConfigRequest, initReq?: fm.InitReq): Promise<GetLoginThemeConfigResponse> {
104
+ return fm.fetchReq<GetLoginThemeConfigRequest, GetLoginThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/login_page?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
105
+ }
106
+ static SetLoginThemeConfig(req: SetLoginThemeConfigRequest, initReq?: fm.InitReq): Promise<SetLoginThemeConfigResponse> {
107
+ return fm.fetchReq<SetLoginThemeConfigRequest, SetLoginThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/login_page`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
108
+ }
109
+ static ResetLoginThemeConfig(req: ResetLoginThemeConfigRequest, initReq?: fm.InitReq): Promise<ResetLoginThemeConfigResponse> {
110
+ return fm.fetchReq<ResetLoginThemeConfigRequest, ResetLoginThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/login_page/reset`, {...initReq, method: "POST"})
111
+ }
112
+ static GetFooterThemeConfig(req: GetFooterThemeConfigRequest, initReq?: fm.InitReq): Promise<GetFooterThemeConfigResponse> {
113
+ return fm.fetchReq<GetFooterThemeConfigRequest, GetFooterThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/footer-theme?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
114
+ }
115
+ static SetFooterThemeConfig(req: SetFooterThemeConfigRequest, initReq?: fm.InitReq): Promise<SetFooterThemeConfigResponse> {
116
+ return fm.fetchReq<SetFooterThemeConfigRequest, SetFooterThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/footer-theme`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
117
+ }
118
+ static ResetFooterThemeConfig(req: ResetFooterThemeConfigRequest, initReq?: fm.InitReq): Promise<ResetFooterThemeConfigResponse> {
119
+ return fm.fetchReq<ResetFooterThemeConfigRequest, ResetFooterThemeConfigResponse>(`/apis/ghippo.io/v1alpha1/themes/footer/reset`, {...initReq, method: "POST"})
120
+ }
121
+ }
@@ -0,0 +1,42 @@
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 TopNavRequest = {
9
+ }
10
+
11
+ export type TopNavResponse = {
12
+ icon?: string
13
+ favicon?: string
14
+ tabName?: string
15
+ }
16
+
17
+ export type SetTopNavRequest = {
18
+ icon?: string
19
+ favicon?: string
20
+ tabName?: string
21
+ }
22
+
23
+ export type SetTopNavResponse = {
24
+ }
25
+
26
+ export type ResetTopNavRequest = {
27
+ }
28
+
29
+ export type ResetTopNavResponse = {
30
+ }
31
+
32
+ export class TopNavigator {
33
+ static Info(req: TopNavRequest, initReq?: fm.InitReq): Promise<TopNavResponse> {
34
+ return fm.fetchReq<TopNavRequest, TopNavResponse>(`/apis/ghippo.io/v1alpha1/top-nav/info?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
35
+ }
36
+ static SetTopNav(req: SetTopNavRequest, initReq?: fm.InitReq): Promise<SetTopNavResponse> {
37
+ return fm.fetchReq<SetTopNavRequest, SetTopNavResponse>(`/apis/ghippo.io/v1alpha1/top-nav`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
38
+ }
39
+ static ResetTopNav(req: ResetTopNavRequest, initReq?: fm.InitReq): Promise<ResetTopNavResponse> {
40
+ return fm.fetchReq<ResetTopNavRequest, ResetTopNavResponse>(`/apis/ghippo.io/v1alpha1/top-nav/reset`, {...initReq, method: "POST"})
41
+ }
42
+ }
@@ -0,0 +1,325 @@
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 ListUsersRequest = {
9
+ search?: string
10
+ pageSize?: number
11
+ page?: number
12
+ }
13
+
14
+ export type ListUsersResponse = {
15
+ items?: GetUserResponse[]
16
+ pagination?: Pagination
17
+ }
18
+
19
+ export type Pagination = {
20
+ page?: number
21
+ pageSize?: number
22
+ total?: number
23
+ }
24
+
25
+ export type CheckUserRequest = {
26
+ username?: string
27
+ }
28
+
29
+ export type CheckUserResponse = {
30
+ existed?: boolean
31
+ }
32
+
33
+ export type CheckUserEmailRequest = {
34
+ username?: string
35
+ }
36
+
37
+ export type CheckUserEmailResponse = {
38
+ existed?: boolean
39
+ }
40
+
41
+ export type GetUserRequest = {
42
+ id?: string
43
+ }
44
+
45
+ export type GetUserResponse = {
46
+ id?: string
47
+ name?: string
48
+ email?: string
49
+ description?: string
50
+ firstname?: string
51
+ lastname?: string
52
+ source?: string
53
+ enabled?: boolean
54
+ createdAt?: string
55
+ updatedAt?: string
56
+ lastLoginAt?: string
57
+ canAuthorize?: boolean
58
+ }
59
+
60
+ export type GetUserByNameRequest = {
61
+ username?: string
62
+ }
63
+
64
+ export type CreateUserRequest = {
65
+ name?: string
66
+ password?: string
67
+ description?: string
68
+ temporary?: boolean
69
+ }
70
+
71
+ export type CreateUserResponse = {
72
+ id?: string
73
+ }
74
+
75
+ export type CreateUserWithoutPasswordRequest = {
76
+ name?: string
77
+ }
78
+
79
+ export type CreateUserWithoutPasswordResponse = {
80
+ id?: string
81
+ }
82
+
83
+ export type DeleteUserRequest = {
84
+ id?: string
85
+ }
86
+
87
+ export type DeleteUserResponse = {
88
+ }
89
+
90
+ export type UpdateUserRequest = {
91
+ id?: string
92
+ enabled?: boolean
93
+ email?: string
94
+ description?: string
95
+ firstname?: string
96
+ lastname?: string
97
+ }
98
+
99
+ export type UpdateUserResponse = {
100
+ }
101
+
102
+ export type SetUserPasswordRequest = {
103
+ id?: string
104
+ password?: string
105
+ }
106
+
107
+ export type SetUserPasswordResponse = {
108
+ }
109
+
110
+ export type Group = {
111
+ id?: string
112
+ name?: string
113
+ }
114
+
115
+ export type ListUserGroupsRequest = {
116
+ id?: string
117
+ search?: string
118
+ page?: number
119
+ pageSize?: number
120
+ }
121
+
122
+ export type ListUserGroupsResponse = {
123
+ pagination?: Pagination
124
+ items?: Group[]
125
+ }
126
+
127
+ export type ListUserRolesRequest = {
128
+ id?: string
129
+ search?: string
130
+ page?: number
131
+ pageSize?: number
132
+ type?: string
133
+ authorized?: boolean
134
+ }
135
+
136
+ export type ListUserRolesResponse = {
137
+ pagination?: Pagination
138
+ authorizedCount?: number
139
+ items?: RoleInfo[]
140
+ }
141
+
142
+ export type RoleInfo = {
143
+ name?: string
144
+ type?: string
145
+ description?: string
146
+ createdAt?: string
147
+ updatedAt?: string
148
+ authorized?: boolean
149
+ }
150
+
151
+ export type ListUserSubjectRequest = {
152
+ id?: string
153
+ search?: string
154
+ page?: number
155
+ pageSize?: number
156
+ }
157
+
158
+ export type ListUserSubjectResponse = {
159
+ pagination?: Pagination
160
+ items?: UserSubject[]
161
+ }
162
+
163
+ export type UserSubject = {
164
+ id?: string
165
+ type?: string
166
+ roleName?: string
167
+ subjectName?: string
168
+ }
169
+
170
+ export type UpdateUserRolesRequest = {
171
+ id?: string
172
+ addRoles?: string[]
173
+ removeRoles?: string[]
174
+ }
175
+
176
+ export type UpdateUserRolesResponse = {
177
+ }
178
+
179
+ export type ListUserAccessTokensRequest = {
180
+ id?: string
181
+ }
182
+
183
+ export type ListUserAccessTokensResponse = {
184
+ items?: AccessToken[]
185
+ }
186
+
187
+ export type AccessToken = {
188
+ id?: string
189
+ name?: string
190
+ updatedAt?: string
191
+ createdAt?: string
192
+ expiredAt?: string
193
+ }
194
+
195
+ export type CreateUserAccessTokenRequest = {
196
+ id?: string
197
+ name?: string
198
+ expiredAt?: string
199
+ }
200
+
201
+ export type CreateUserAccessTokenResponse = {
202
+ id?: string
203
+ token?: string
204
+ }
205
+
206
+ export type DeleteUserAccessTokenRequest = {
207
+ id?: string
208
+ aid?: string
209
+ }
210
+
211
+ export type DeleteUserAccessTokenResponse = {
212
+ }
213
+
214
+ export type ResetUserMFARequest = {
215
+ id?: string
216
+ }
217
+
218
+ export type ResetUserMFAResponse = {
219
+ }
220
+
221
+ export type VerifyUserSSHPublicKeyRequest = {
222
+ username?: string
223
+ publicKey?: Uint8Array
224
+ }
225
+
226
+ export type VerifyUserSSHPublicKeyResponse = {
227
+ }
228
+
229
+ export type ListUsersSSHPublicKeysRequest = {
230
+ userIds?: string[]
231
+ }
232
+
233
+ export type ListUsersSSHPublicKeysResponse = {
234
+ values?: {[key: string]: UserSSHKeys}
235
+ }
236
+
237
+ export type UserSSHKeys = {
238
+ values?: SSHKey[]
239
+ }
240
+
241
+ export type SSHKey = {
242
+ name?: string
243
+ publicKey?: string
244
+ createdAt?: string
245
+ updatedAt?: string
246
+ expiredAt?: string
247
+ enabled?: boolean
248
+ }
249
+
250
+ export type GetUserCertifyInfoRequest = {
251
+ id?: string
252
+ }
253
+
254
+ export type GetUserCertifyInfoResponse = {
255
+ isCsp?: boolean
256
+ realName?: string
257
+ idCard?: string
258
+ certifyAt?: string
259
+ }
260
+
261
+ export class Users {
262
+ static ListUsers(req: ListUsersRequest, initReq?: fm.InitReq): Promise<ListUsersResponse> {
263
+ return fm.fetchReq<ListUsersRequest, ListUsersResponse>(`/apis/ghippo.io/v1alpha1/users?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
264
+ }
265
+ static CheckUser(req: CheckUserRequest, initReq?: fm.InitReq): Promise<CheckUserResponse> {
266
+ return fm.fetchReq<CheckUserRequest, CheckUserResponse>(`/apis/ghippo.io/v1alpha1/users/check/${req["username"]}?${fm.renderURLSearchParams(req, ["username"])}`, {...initReq, method: "GET"})
267
+ }
268
+ static CheckUserEmail(req: CheckUserEmailRequest, initReq?: fm.InitReq): Promise<CheckUserEmailResponse> {
269
+ return fm.fetchReq<CheckUserEmailRequest, CheckUserEmailResponse>(`/apis/ghippo.io/v1alpha1/users/check-user-email/${req["username"]}?${fm.renderURLSearchParams(req, ["username"])}`, {...initReq, method: "GET"})
270
+ }
271
+ static GetUser(req: GetUserRequest, initReq?: fm.InitReq): Promise<GetUserResponse> {
272
+ return fm.fetchReq<GetUserRequest, GetUserResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
273
+ }
274
+ static GetUserByName(req: GetUserByNameRequest, initReq?: fm.InitReq): Promise<GetUserResponse> {
275
+ return fm.fetchReq<GetUserByNameRequest, GetUserResponse>(`/apis/ghippo.io/v1alpha1/users/username/${req["username"]}?${fm.renderURLSearchParams(req, ["username"])}`, {...initReq, method: "GET"})
276
+ }
277
+ static CreateUser(req: CreateUserRequest, initReq?: fm.InitReq): Promise<CreateUserResponse> {
278
+ return fm.fetchReq<CreateUserRequest, CreateUserResponse>(`/apis/ghippo.io/v1alpha1/users`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
279
+ }
280
+ static CreateUserWithoutPassword(req: CreateUserWithoutPasswordRequest, initReq?: fm.InitReq): Promise<CreateUserWithoutPasswordResponse> {
281
+ return fm.fetchReq<CreateUserWithoutPasswordRequest, CreateUserWithoutPasswordResponse>(`/apis/ghippo.io/v1alpha1/users/without-password`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
282
+ }
283
+ static DeleteUser(req: DeleteUserRequest, initReq?: fm.InitReq): Promise<DeleteUserResponse> {
284
+ return fm.fetchReq<DeleteUserRequest, DeleteUserResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}`, {...initReq, method: "DELETE"})
285
+ }
286
+ static UpdateUser(req: UpdateUserRequest, initReq?: fm.InitReq): Promise<UpdateUserResponse> {
287
+ return fm.fetchReq<UpdateUserRequest, UpdateUserResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
288
+ }
289
+ static SetUserPassword(req: SetUserPasswordRequest, initReq?: fm.InitReq): Promise<SetUserPasswordResponse> {
290
+ return fm.fetchReq<SetUserPasswordRequest, SetUserPasswordResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/password`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
291
+ }
292
+ static ResetUserMFA(req: ResetUserMFARequest, initReq?: fm.InitReq): Promise<ResetUserMFAResponse> {
293
+ return fm.fetchReq<ResetUserMFARequest, ResetUserMFAResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/mfa`, {...initReq, method: "DELETE"})
294
+ }
295
+ static ListUserGroups(req: ListUserGroupsRequest, initReq?: fm.InitReq): Promise<ListUserGroupsResponse> {
296
+ return fm.fetchReq<ListUserGroupsRequest, ListUserGroupsResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/groups?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
297
+ }
298
+ static ListUserRoles(req: ListUserRolesRequest, initReq?: fm.InitReq): Promise<ListUserRolesResponse> {
299
+ return fm.fetchReq<ListUserRolesRequest, ListUserRolesResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/roles?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
300
+ }
301
+ static ListUserSubjects(req: ListUserSubjectRequest, initReq?: fm.InitReq): Promise<ListUserSubjectResponse> {
302
+ return fm.fetchReq<ListUserSubjectRequest, ListUserSubjectResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/subjects?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
303
+ }
304
+ static UpdateUserRoles(req: UpdateUserRolesRequest, initReq?: fm.InitReq): Promise<UpdateUserRolesResponse> {
305
+ return fm.fetchReq<UpdateUserRolesRequest, UpdateUserRolesResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/roles`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
306
+ }
307
+ static ListUserAccessTokens(req: ListUserAccessTokensRequest, initReq?: fm.InitReq): Promise<ListUserAccessTokensResponse> {
308
+ return fm.fetchReq<ListUserAccessTokensRequest, ListUserAccessTokensResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/accesstokens?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
309
+ }
310
+ static CreateUserAccessToken(req: CreateUserAccessTokenRequest, initReq?: fm.InitReq): Promise<CreateUserAccessTokenResponse> {
311
+ return fm.fetchReq<CreateUserAccessTokenRequest, CreateUserAccessTokenResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/accesstoken`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
312
+ }
313
+ static DeleteUserAccessToken(req: DeleteUserAccessTokenRequest, initReq?: fm.InitReq): Promise<DeleteUserAccessTokenResponse> {
314
+ return fm.fetchReq<DeleteUserAccessTokenRequest, DeleteUserAccessTokenResponse>(`/apis/ghippo.io/v1alpha1/users/${req["id"]}/accesstokens/${req["aid"]}`, {...initReq, method: "DELETE"})
315
+ }
316
+ static VerifyUserSSHPublicKey(req: VerifyUserSSHPublicKeyRequest, initReq?: fm.InitReq): Promise<VerifyUserSSHPublicKeyResponse> {
317
+ return fm.fetchReq<VerifyUserSSHPublicKeyRequest, VerifyUserSSHPublicKeyResponse>(`/apis/ghippo.io/v1alpha1/users/${req["username"]}/sshkeys/verify`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
318
+ }
319
+ static ListUsersSSHPublicKeys(req: ListUsersSSHPublicKeysRequest, initReq?: fm.InitReq): Promise<ListUsersSSHPublicKeysResponse> {
320
+ return fm.fetchReq<ListUsersSSHPublicKeysRequest, ListUsersSSHPublicKeysResponse>(`/v1alpha1.user.Users/ListUsersSSHPublicKeys`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
321
+ }
322
+ static GetUserCertifyInfo(req: GetUserCertifyInfoRequest, initReq?: fm.InitReq): Promise<GetUserCertifyInfoResponse> {
323
+ return fm.fetchReq<GetUserCertifyInfoRequest, GetUserCertifyInfoResponse>(`/v1alpha1.user.Users/GetUserCertifyInfo`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
324
+ }
325
+ }
@@ -0,0 +1,180 @@
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 ResourceType {
10
+ resource_type_user = "resource_type_user",
11
+ }
12
+
13
+ export enum Action {
14
+ action_create = "action_create",
15
+ action_update = "action_update",
16
+ action_delete = "action_delete",
17
+ action_login = "action_login",
18
+ action_logout = "action_logout",
19
+ }
20
+
21
+ export enum Method {
22
+ method_get = "method_get",
23
+ method_post = "method_post",
24
+ method_put = "method_put",
25
+ method_delete = "method_delete",
26
+ method_patch = "method_patch",
27
+ }
28
+
29
+ export enum Status {
30
+ all = "all",
31
+ successful = "successful",
32
+ failed = "failed",
33
+ }
34
+
35
+ export enum StatusResponse {
36
+ response_unknown = "response_unknown",
37
+ response_successful = "response_successful",
38
+ response_failed = "response_failed",
39
+ }
40
+
41
+ export type WebhookInfo = {
42
+ id?: number
43
+ name?: string
44
+ clientId?: string
45
+ resourceType?: ResourceType
46
+ action?: Action
47
+ url?: string
48
+ method?: Method
49
+ headers?: string
50
+ requestParameter?: string
51
+ createdAt?: string
52
+ updatedAt?: string
53
+ }
54
+
55
+ export type Pagination = {
56
+ page?: number
57
+ pageSize?: number
58
+ total?: number
59
+ }
60
+
61
+ export type CreateWebhookRequest = {
62
+ name?: string
63
+ clientId?: string
64
+ resourceType?: ResourceType
65
+ action?: Action
66
+ url?: string
67
+ method?: Method
68
+ headers?: string
69
+ requestParameter?: string
70
+ }
71
+
72
+ export type CreateWebhookResponse = {
73
+ }
74
+
75
+ export type GetWebhookRequest = {
76
+ id?: number
77
+ }
78
+
79
+ export type GetWebhookResponse = {
80
+ webhookInfo?: WebhookInfo
81
+ }
82
+
83
+ export type ListWebhooksByClientIdRequest = {
84
+ search?: string
85
+ pageSize?: number
86
+ page?: number
87
+ clientId?: string
88
+ }
89
+
90
+ export type ListWebhooksByClientIdResponse = {
91
+ items?: WebhookInfo[]
92
+ pagination?: Pagination
93
+ }
94
+
95
+ export type UpdateWebhookRequest = {
96
+ id?: number
97
+ name?: string
98
+ clientId?: string
99
+ resourceType?: ResourceType
100
+ action?: Action
101
+ url?: string
102
+ method?: Method
103
+ headers?: string
104
+ requestParameter?: string
105
+ }
106
+
107
+ export type UpdateWebhookResponse = {
108
+ }
109
+
110
+ export type DeleteWebhookRequest = {
111
+ id?: number
112
+ }
113
+
114
+ export type DeleteWebhookResponse = {
115
+ }
116
+
117
+ export type WebhookRecordInfo = {
118
+ id?: number
119
+ clientId?: string
120
+ webhookId?: number
121
+ webhookName?: string
122
+ resourceType?: ResourceType
123
+ action?: Action
124
+ url?: string
125
+ method?: Method
126
+ eventTime?: string
127
+ eventData?: string
128
+ statusCode?: number
129
+ status?: StatusResponse
130
+ requestedAt?: string
131
+ request?: string
132
+ respondedAt?: string
133
+ response?: string
134
+ errMessage?: string
135
+ }
136
+
137
+ export type GetWebhookRecordRequest = {
138
+ id?: number
139
+ }
140
+
141
+ export type GetWebhookRecordResponse = {
142
+ webhookRecordInfo?: WebhookRecordInfo
143
+ }
144
+
145
+ export type ListWebhookRecordsByClientIdRequest = {
146
+ clientId?: string
147
+ search?: string
148
+ status?: Status
149
+ pageSize?: number
150
+ page?: number
151
+ }
152
+
153
+ export type ListWebhookRecordsByClientIdResponse = {
154
+ items?: WebhookRecordInfo[]
155
+ pagination?: Pagination
156
+ }
157
+
158
+ export class Webhook {
159
+ static CreateWebhook(req: CreateWebhookRequest, initReq?: fm.InitReq): Promise<CreateWebhookResponse> {
160
+ return fm.fetchReq<CreateWebhookRequest, CreateWebhookResponse>(`/apis/ghippo.io/v1alpha1/webhook`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
161
+ }
162
+ static GetWebhook(req: GetWebhookRequest, initReq?: fm.InitReq): Promise<GetWebhookResponse> {
163
+ return fm.fetchReq<GetWebhookRequest, GetWebhookResponse>(`/apis/ghippo.io/v1alpha1/webhook/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
164
+ }
165
+ static ListWebhooksByClientId(req: ListWebhooksByClientIdRequest, initReq?: fm.InitReq): Promise<ListWebhooksByClientIdResponse> {
166
+ return fm.fetchReq<ListWebhooksByClientIdRequest, ListWebhooksByClientIdResponse>(`/apis/ghippo.io/v1alpha1/webhook?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
167
+ }
168
+ static UpdateWebhook(req: UpdateWebhookRequest, initReq?: fm.InitReq): Promise<UpdateWebhookResponse> {
169
+ return fm.fetchReq<UpdateWebhookRequest, UpdateWebhookResponse>(`/apis/ghippo.io/v1alpha1/webhook/${req["id"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
170
+ }
171
+ static DeleteWebhook(req: DeleteWebhookRequest, initReq?: fm.InitReq): Promise<DeleteWebhookResponse> {
172
+ return fm.fetchReq<DeleteWebhookRequest, DeleteWebhookResponse>(`/apis/ghippo.io/v1alpha1/webhook/${req["id"]}`, {...initReq, method: "DELETE"})
173
+ }
174
+ static GetWebhookRecord(req: GetWebhookRecordRequest, initReq?: fm.InitReq): Promise<GetWebhookRecordResponse> {
175
+ return fm.fetchReq<GetWebhookRecordRequest, GetWebhookRecordResponse>(`/apis/ghippo.io/v1alpha1/webhook-record/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
176
+ }
177
+ static ListWebhookRecordsByClientId(req: ListWebhookRecordsByClientIdRequest, initReq?: fm.InitReq): Promise<ListWebhookRecordsByClientIdResponse> {
178
+ return fm.fetchReq<ListWebhookRecordsByClientIdRequest, ListWebhookRecordsByClientIdResponse>(`/apis/ghippo.io/v1alpha1/webhook-record?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
179
+ }
180
+ }