Skip to content

Commit 448700d

Browse files
authored
feat(account): support multiple captcha providers during account creation (#580)
1 parent f1a5662 commit 448700d

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

packages/clients/src/api/account/v2/api.gen.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import {
99
import {
1010
marshalCreateProjectRequest,
1111
marshalUpdateProjectRequest,
12+
unmarshalCaptchaProvider,
1213
unmarshalListProjectsResponse,
1314
unmarshalProject,
1415
} from './marshalling.gen'
1516
import type {
17+
CaptchaProvider,
1618
CreateProjectRequest,
1719
DeleteProjectRequest,
1820
GetProjectRequest,
@@ -149,4 +151,18 @@ export class API extends ParentAPI {
149151
},
150152
unmarshalProject,
151153
)
154+
155+
/**
156+
* Get a Captcha provider.
157+
*
158+
* @returns A Promise of CaptchaProvider
159+
*/
160+
getCaptchaProvider = () =>
161+
this.client.fetch<CaptchaProvider>(
162+
{
163+
method: 'GET',
164+
path: `/account/v2/captcha-provider`,
165+
},
166+
unmarshalCaptchaProvider,
167+
)
152168
}

packages/clients/src/api/account/v2/index.gen.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
export { API } from './api.gen'
44
export type {
5+
CaptchaProvider,
6+
CaptchaProviderName,
57
CreateProjectRequest,
68
DeleteProjectRequest,
79
GetProjectRequest,

packages/clients/src/api/account/v2/marshalling.gen.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '../../../bridge'
88
import type { DefaultValues } from '../../../bridge'
99
import type {
10+
CaptchaProvider,
1011
CreateProjectRequest,
1112
ListProjectsResponse,
1213
Project,
@@ -30,6 +31,16 @@ export const unmarshalProject = (data: unknown) => {
3031
} as Project
3132
}
3233

34+
export const unmarshalCaptchaProvider = (data: unknown) => {
35+
if (!isJSONObject(data)) {
36+
throw new TypeError(
37+
`Unmarshalling the type 'CaptchaProvider' failed as data isn't a dictionary.`,
38+
)
39+
}
40+
41+
return { name: data.name } as CaptchaProvider
42+
}
43+
3344
export const unmarshalListProjectsResponse = (data: unknown) => {
3445
if (!isJSONObject(data)) {
3546
throw new TypeError(

packages/clients/src/api/account/v2/types.gen.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
33

4+
export type CaptchaProviderName =
5+
| 'unknown_name'
6+
| 'recaptcha_v2'
7+
| 'friendly_captcha'
8+
| 'hcaptcha'
9+
410
export type ListProjectsRequestOrderBy =
511
| 'created_at_asc'
612
| 'created_at_desc'
713
| 'name_asc'
814
| 'name_desc'
915

16+
export interface CaptchaProvider {
17+
name: CaptchaProviderName
18+
}
19+
1020
/** List projects response. */
1121
export interface ListProjectsResponse {
1222
/** Total number of Projects. */

0 commit comments

Comments
 (0)