Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/clients/src/api/account/v2/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import {
import {
marshalCreateProjectRequest,
marshalUpdateProjectRequest,
unmarshalCaptchaProvider,
unmarshalListProjectsResponse,
unmarshalProject,
} from './marshalling.gen'
import type {
CaptchaProvider,
CreateProjectRequest,
DeleteProjectRequest,
GetProjectRequest,
Expand Down Expand Up @@ -149,4 +151,18 @@ export class API extends ParentAPI {
},
unmarshalProject,
)

/**
* Get a Captcha provider.
*
* @returns A Promise of CaptchaProvider
*/
getCaptchaProvider = () =>
this.client.fetch<CaptchaProvider>(
{
method: 'GET',
path: `/account/v2/captcha-provider`,
},
unmarshalCaptchaProvider,
)
}
2 changes: 2 additions & 0 deletions packages/clients/src/api/account/v2/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// If you have any remark or suggestion do not hesitate to open an issue.
export { API } from './api.gen'
export type {
CaptchaProvider,
CaptchaProviderName,
CreateProjectRequest,
DeleteProjectRequest,
GetProjectRequest,
Expand Down
11 changes: 11 additions & 0 deletions packages/clients/src/api/account/v2/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '../../../bridge'
import type { DefaultValues } from '../../../bridge'
import type {
CaptchaProvider,
CreateProjectRequest,
ListProjectsResponse,
Project,
Expand All @@ -30,6 +31,16 @@ export const unmarshalProject = (data: unknown) => {
} as Project
}

export const unmarshalCaptchaProvider = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'CaptchaProvider' failed as data isn't a dictionary.`,
)
}

return { name: data.name } as CaptchaProvider
}

export const unmarshalListProjectsResponse = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down
10 changes: 10 additions & 0 deletions packages/clients/src/api/account/v2/types.gen.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
// This file was automatically generated. DO NOT EDIT.
// If you have any remark or suggestion do not hesitate to open an issue.

export type CaptchaProviderName =
| 'unknown_name'
| 'recaptcha_v2'
| 'friendly_captcha'
| 'hcaptcha'

export type ListProjectsRequestOrderBy =
| 'created_at_asc'
| 'created_at_desc'
| 'name_asc'
| 'name_desc'

export interface CaptchaProvider {
name: CaptchaProviderName
}

/** List projects response. */
export interface ListProjectsResponse {
/** Total number of Projects. */
Expand Down